# HG changeset patch # User Nicholas Riley # Date 1200666209 21600 # Node ID 838fa52abcc184c3d0d9a7b333b82f1f2af35352 # Parent b6d8972ce339e1ccc377d4b12efcb66c373f3745 [PATCH] zsh_completion tag/mq fixes Been using these for almost a month now without problems, so I figured some other people might want them. This allows the zsh completion to work with tags and mq patch names containing spaces, and adds support for qgoto. diff -r b6d8972ce339 -r 838fa52abcc1 contrib/zsh_completion --- a/contrib/zsh_completion Fri Jan 18 03:06:05 2008 +0200 +++ b/contrib/zsh_completion Fri Jan 18 08:23:29 2008 -0600 @@ -13,6 +13,9 @@ # option) any later version. # +emulate -LR zsh +setopt extendedglob + local curcontext="$curcontext" state line typeset -A _hg_cmd_globals @@ -153,9 +156,9 @@ typeset -a tags local tag rev - _hg_cmd tags 2> /dev/null | while read tag rev + _hg_cmd tags 2> /dev/null | while read tag do - tags+=($tag) + tags+=(${tag/ # [0-9]#:*}) done (( $#tags )) && _describe -t tags 'tags' tags } @@ -674,13 +677,13 @@ # MQ _hg_qseries() { typeset -a patches - patches=($(_hg_cmd qseries 2>/dev/null)) + patches=(${(f)"$(_hg_cmd qseries 2>/dev/null)"}) (( $#patches )) && _describe -t hg-patches 'patches' patches } _hg_qapplied() { typeset -a patches - patches=($(_hg_cmd qapplied 2>/dev/null)) + patches=(${(f)"$(_hg_cmd qapplied 2>/dev/null)"}) if (( $#patches )) then patches+=(qbase qtip) @@ -690,7 +693,7 @@ _hg_qunapplied() { typeset -a patches - patches=($(_hg_cmd qunapplied 2>/dev/null)) + patches=(${(f)"$(_hg_cmd qunapplied 2>/dev/null)"}) (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches } @@ -730,6 +733,12 @@ '*:unapplied patch:_hg_qunapplied' } +_hg_cmd_qgoto() { + _arguments -s -w : $_hg_global_opts \ + '(--force -f)'{-f,--force}'[overwrite any local changes]' \ + ':patch:_hg_qseries' +} + _hg_cmd_qguard() { _arguments -s -w : $_hg_global_opts \ '(--list -l)'{-l,--list}'[list all patches and guards]' \