Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[patch] _hg: extend completion for hg push to support branch and bookmark



Hi again.

Below another small patch to extend the completion for mercurials 'hg
push' to also support -b/-B.

thx,
Christoph

PS Please CC on reply, I'm not subscribed.

diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index edd7f0d..856edcf 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -176,6 +176,13 @@ _hg_bookmarks_internal() {
   _wanted bookmarks expl 'bookmarks' compadd -a - hgbookmarks
 }

+_hg_branches_internal() {
+  local expl
+  typeset -a hgtags
+  hgtags=( ${(f)"$(_hg_cmd branches -q 2>/dev/null)"} )
+  _wanted tags expl 'branches' compadd -a - hgtags
+}
+
 _hg_tags() {
   _alternative \
     'bookmarks:bookmark:_hg_bookmarks_internal' \
@@ -659,6 +666,10 @@ _hg_cmd_push() {
   _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[force push]' \
   '(--rev -r)'{-r+,--rev}'[a specific revision you would like to
push]:revision:_hg_tags' \
+  '*'{-B,--bookmark}'[bookmark to push]:bookmark:_hg_bookmarks_internal' \
+  '*'{-b,--branch}'[branch to push]:branch:_hg_branches_internal' \
+  '--insecure[do not verify server certificate]' \
+  '--new-branch[allow pushing a new branch]' \
   ':destination:_hg_remote'
 }



Messages sorted by: Reverse Date, Date, Thread, Author