Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] _hg: extend completion for hg push to support branch and bookmark
- X-seq: zsh-workers 36613
 
- From: Christoph Mathys <eraserix@xxxxxxxxx>
 
- To: zsh-workers@xxxxxxx
 
- Subject: [patch] _hg: extend completion for hg push to support branch and bookmark
 
- Date: Thu, 24 Sep 2015 17:23:06 +0200
 
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20120113;        h=mime-version:date:message-id:subject:from:to:content-type;        bh=5jvqxd4zfbVt9CL4q+YDktkKPm6x9qmKPEt1S08nCAk=;        b=CUK3gJltYy4Q1yZbAbnMGFGOB0bAJcv3IqwAp4lPwkdQpBF0VDnqjozpajjs86CeEb         1btVpgshdKsseJAGzBPYlZIPCU+bqIOfIaOjP1ZPGGvuj6GyUbUgOEFS6xzz6XVraJIL         BDejg3RUWiMqYsUvuJEpQAheOrrxTcOorQfpW7iRpqTWwWg75tfFgbzvBE6Zf+KgdPgt         tDdkKCTStP2yP88bl4Ms95Am6/GBs444oMMO4lTXjwjrCcOJMAL16MUmEdofOUJ9pPoA         IM/3diWxS1cy7arQloT3h7hW/rkI6M7tel2Tb69SiDN0ZW5D9MdCCyI1EMhZTZ2ooLJu         tfyA==
 
- List-help: <mailto:zsh-workers-help@zsh.org>
 
- List-id: Zsh Workers List <zsh-workers.zsh.org>
 
- List-post: <mailto:zsh-workers@zsh.org>
 
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
 
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