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.
This commit is contained in:
Ben Hockey 2011-09-07 10:24:26 -04:00
parent 1a9ba4e000
commit 9ffafb4321

View File

@ -165,6 +165,7 @@ _hg_revrange() {
_hg_labels() {
_hg_tags "$@"
_hg_bookmarks "$@"
_hg_branches "$@"
}
_hg_tags() {
@ -191,6 +192,17 @@ _hg_bookmarks() {
(( $#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 @@ _hg_cmd_log() {
'(--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'
}