Mercurial > hg
changeset 15100:a051f8a6a7cc
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.
author | Ben Hockey <neonstalwart@gmail.com> |
---|---|
date | Wed, 07 Sep 2011 10:24:26 -0400 |
parents | b1f49efeab65 |
children | a21ccf4412d5 |
files | contrib/zsh_completion |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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' }