changeset 18903:5df602551eea

zsh_completion: make use of `debuglabelcomplete` command Use `debuglabelcomplete` command when populating labels list, instead of calling `hg` three times: for branches, bookmarks and tags. Do not pass string being completed to `hg debuglabelcomplete` (as `$words[$CURRENT]`), since it breaks `_hg_revrange` completion (`--rev 2.5:2.5.<Tab>`) for no apparent benefit. Also complete `hg view` with labels, not just tags, and drop unused `_hg_tags`.
author Nikolaj Sjujskij <sterkrig@myopera.com>
date Mon, 08 Apr 2013 16:51:38 +0400
parents 8c0a7eeda06d
children e9331e979d7a
files contrib/zsh_completion
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/zsh_completion	Wed Apr 10 15:08:28 2013 -0700
+++ b/contrib/zsh_completion	Mon Apr 08 16:51:38 2013 +0400
@@ -163,21 +163,10 @@
 }
 
 _hg_labels() {
-  _hg_tags "$@"
-  _hg_bookmarks "$@"
-  _hg_branches "$@"
+  labels=("${(f)$(_hg_cmd debuglabelcomplete)}")
+  (( $#labels )) && _describe -t labels 'labels' labels
 }
 
-_hg_tags() {
-  typeset -a tags
-  local tag rev
-
-  _hg_cmd tags | while read tag
-  do
-    tags+=(${tag/ #[0-9]#:*})
-  done
-  (( $#tags )) && _describe -t tags 'tags' tags
-}
 _hg_bookmarks() {
   typeset -a bookmark bookmarks
 
@@ -940,7 +929,7 @@
 _hg_cmd_view() {
   _arguments -s -w : $_hg_global_opts \
   '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
-  ':revision range:_hg_tags'
+  ':revision range:_hg_labels'
 }
 
 # MQ