# HG changeset patch # User Ben Hockey # Date 1315405466 14400 # Node ID a051f8a6a7ccd93bce8aa856f8e48b7a1ca01f46 # Parent b1f49efeab65b70124ea0e1a15393dc3812a1997 contrib: some support for named branches in zsh_completion (issue2988) named branches were not included for autocompletion in zsh. by adding _hg_branches and calling it from _hg_labels, named branches are now included when autocompleting many commands in zsh. support for completion of hg log -b was also added. there are possibly other cases where support needs to be explicitly added. diff -r b1f49efeab65 -r a051f8a6a7cc contrib/zsh_completion --- 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' }