contrib/zsh_completion
changeset 15100 a051f8a6a7cc
parent 13562 7c6e9b57a4cc
child 15645 88a82069be4a
--- a/contrib/zsh_completion	Wed Sep 14 17:06:33 2011 +0200
+++ b/contrib/zsh_completion	Wed Sep 07 10:24:26 2011 -0400
@@ -165,6 +165,7 @@
 _hg_labels() {
   _hg_tags "$@"
   _hg_bookmarks "$@"
+  _hg_branches "$@"
 }
 
 _hg_tags() {
@@ -191,6 +192,17 @@
   (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
 }
 
+_hg_branches() {
+  typeset -a branches
+  local branch
+
+  _hg_cmd branches | while read branch
+  do
+    branches+=(${branch/ #    [0-9]#:*})
+  done
+  (( $#branches )) && _describe -t branches 'branches' branches
+}
+
 # likely merge candidates
 _hg_mergerevs() {
   typeset -a heads
@@ -617,6 +629,7 @@
   '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
   '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
+  '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \
   '*:files:_hg_files'
 }