annotate contrib/zsh_completion @ 8941:37a9d551346c

addremove: drop some silly variable assignments
author Matt Mackall <mpm@selenic.com>
date Tue, 23 Jun 2009 17:51:51 -0500
parents 704833724ff6
children c963d49ac7a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
1 #compdef hg
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
2
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
3 # Zsh completion script for mercurial. Rename this file to _hg and copy
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
4 # it into your zsh function path (/usr/share/zsh/site-functions for
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
5 # instance)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
6 #
8616
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
7 # If you do not want to install it globally, you can copy it somewhere
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
8 # else and add that directory to $fpath. This must be done before
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
9 # compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
10 # file could look like this:
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
11 #
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
12 # fpath=("$HOME/.zsh.d" $fpath)
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
13 # autoload -U compinit
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
14 # compinit
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
15 #
7466
05010666fb19 Update zsh completion for new help format
Brendan Cully <brendan@kublai.com>
parents: 7386
diff changeset
16 # Copyright (C) 2005-6 Steve Borho
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
17 # Copyright (C) 2006-8 Brendan Cully <brendan@kublai.com>
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
18 #
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
19 # This is free software; you can redistribute it and/or modify it under
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
20 # the terms of the GNU General Public License as published by the Free
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
21 # Software Foundation; either version 2 of the License, or (at your
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
22 # option) any later version.
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
23
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
24 emulate -LR zsh
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
25 setopt extendedglob
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
26
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
27 local curcontext="$curcontext" state line
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
28 typeset -A _hg_cmd_globals
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
29
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
30 _hg() {
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
31 local cmd _hg_root
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
32 integer i=2
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
33 _hg_cmd_globals=()
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
34
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
35 while (( i < $#words ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
36 do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
37 case "$words[$i]" in
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
38 -R|--repository)
3605
9d815b074dcb zsh: perform ~ expansion on _hg_root
Brendan Cully <brendan@kublai.com>
parents: 3603
diff changeset
39 eval _hg_root="$words[$i+1]"
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
40 _hg_cmd_globals+=("$words[$i]" "$_hg_root")
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
41 (( i += 2 ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
42 continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
43 ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
44 -R*)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
45 _hg_cmd_globals+="$words[$i]"
3605
9d815b074dcb zsh: perform ~ expansion on _hg_root
Brendan Cully <brendan@kublai.com>
parents: 3603
diff changeset
46 eval _hg_root="${words[$i]#-R}"
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
47 (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
48 continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
49 ;;
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
50 --cwd|--config)
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
51 # pass along arguments to hg completer
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
52 _hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
53 (( i += 2 ))
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
54 continue
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
55 ;;
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
56 -*)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
57 # skip option
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
58 (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
59 continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
60 ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
61 esac
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
62 if [[ -z "$cmd" ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
63 then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
64 cmd="$words[$i]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
65 words[$i]=()
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
66 (( CURRENT-- ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
67 fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
68 (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
69 done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
70
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
71 if [[ -z "$cmd" ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
72 then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
73 _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
74 ':mercurial command:_hg_commands'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
75 return
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
76 fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
77
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
78 # resolve abbreviations and aliases
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
79 if ! (( $+functions[_hg_cmd_${cmd}] ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
80 then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
81 local cmdexp
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
82 (( $#_hg_cmd_list )) || _hg_get_commands
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
83
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
84 cmdexp=$_hg_cmd_list[(r)${cmd}*]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
85 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
86 then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
87 # might be nice to rewrite the command line with the expansion
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
88 cmd="$cmdexp"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
89 fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
90 if [[ -n $_hg_alias_list[$cmd] ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
91 then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
92 cmd=$_hg_alias_list[$cmd]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
93 fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
94 fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
95
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
96 curcontext="${curcontext%:*:*}:hg-${cmd}:"
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
97
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
98 zstyle -s ":completion:$curcontext:" cache-policy update_policy
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
99
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
100 if [[ -z "$update_policy" ]]
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
101 then
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
102 zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
103 fi
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
104
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
105 if (( $+functions[_hg_cmd_${cmd}] ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
106 then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
107 _hg_cmd_${cmd}
3597
0d253ec988a6 zsh: complete unknown commands normally
Brendan Cully <brendan@kublai.com>
parents: 3587
diff changeset
108 else
0d253ec988a6 zsh: complete unknown commands normally
Brendan Cully <brendan@kublai.com>
parents: 3587
diff changeset
109 # complete unknown commands normally
0d253ec988a6 zsh: complete unknown commands normally
Brendan Cully <brendan@kublai.com>
parents: 3587
diff changeset
110 _arguments -s -w : $_hg_global_opts \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
111 '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
112 fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
113 }
3497
459e7cd943d4 zsh: complete according to the -R option if specified
Brendan Cully <brendan@kublai.com>
parents: 3496
diff changeset
114
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
115 _hg_cache_policy() {
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
116 typeset -a old
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
117
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
118 # cache for a minute
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
119 old=( "$1"(mm+10) )
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
120 (( $#old )) && return 0
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
121
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
122 return 1
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
123 }
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
124
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
125 _hg_get_commands() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
126 typeset -ga _hg_cmd_list
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
127 typeset -gA _hg_alias_list
7510
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
128 local hline cmd cmdalias
7466
05010666fb19 Update zsh completion for new help format
Brendan Cully <brendan@kublai.com>
parents: 7386
diff changeset
129
7510
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
130 _call_program hg hg debugcomplete -v 2>/dev/null | while read -A hline
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
131 do
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
132 cmd=$hline[1]
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
133 _hg_cmd_list+=($cmd)
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
134
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
135 for cmdalias in $hline[2,-1]
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
136 do
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
137 _hg_cmd_list+=($cmdalias)
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
138 _hg_alias_list+=($cmdalias $cmd)
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
139 done
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
140 done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
141 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
142
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
143 _hg_commands() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
144 (( $#_hg_cmd_list )) || _hg_get_commands
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
145 _describe -t commands 'mercurial command' _hg_cmd_list
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
146 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
147
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
148 _hg_revrange() {
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
149 compset -P 1 '*:'
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
150 _hg_tags "$@"
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
151 }
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
152
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
153 _hg_tags() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
154 typeset -a tags
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
155 local tag rev
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
156
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
157 _hg_cmd tags 2> /dev/null | while read tag
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
158 do
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
159 tags+=(${tag/ # [0-9]#:*})
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
160 done
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
161 (( $#tags )) && _describe -t tags 'tags' tags
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
162 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
163
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
164 _hg_files() {
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
165 if [[ -n "$_hg_root" ]]
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
166 then
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
167 [[ -d "$_hg_root/.hg" ]] || return
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
168 case "$_hg_root" in
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
169 /*)
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
170 _files -W $_hg_root
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
171 ;;
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
172 *)
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
173 _files -W $PWD/$_hg_root
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
174 ;;
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
175 esac
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
176 else
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
177 _files
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
178 fi
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
179 }
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
180
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
181 _hg_status() {
3878
729f354f3f09 zsh: better fix for partial completions
Steve Borho <steve@borho.org>
parents: 3817
diff changeset
182 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
3817
45a751d73080 zsh: fix completions with relative paths
Steve Borho <steve@borho.org>
parents: 3816
diff changeset
183 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"})
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
184 }
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
185
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
186 _hg_unknown() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
187 typeset -a status_files
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
188 _hg_status u
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
189 _wanted files expl 'unknown files' _multi_parts / status_files
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
190 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
191
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
192 _hg_missing() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
193 typeset -a status_files
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
194 _hg_status d
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
195 _wanted files expl 'missing files' _multi_parts / status_files
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
196 }
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
197
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
198 _hg_modified() {
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
199 typeset -a status_files
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
200 _hg_status m
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
201 _wanted files expl 'modified files' _multi_parts / status_files
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
202 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
203
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
204 _hg_resolve() {
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
205 local rstate rpah
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
206
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
207 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
208
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
209 _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
210 do
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
211 [[ $rstate == 'R' ]] && resolved_files+=($rpath)
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
212 [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
213 done
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
214 }
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
215
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
216 _hg_resolved() {
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
217 typeset -a resolved_files unresolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
218 _hg_resolve
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
219 _wanted files expl 'resolved files' _multi_parts / resolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
220 }
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
221
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
222 _hg_unresolved() {
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
223 typeset -a resolved_files unresolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
224 _hg_resolve
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
225 _wanted files expl 'unresolved files' _multi_parts / unresolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
226 }
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
227
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
228 _hg_config() {
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
229 typeset -a items
6804
694223a29ad4 Added missing --config global option to zsh_completion.
byron@base2.cc
parents: 5868
diff changeset
230 items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
231 (( $#items )) && _describe -t config 'config item' items
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
232 }
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
233
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
234 _hg_addremove() {
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
235 _alternative 'files:unknown files:_hg_unknown' \
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
236 'files:missing files:_hg_missing'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
237 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
238
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
239 _hg_ssh_urls() {
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
240 if [[ -prefix */ ]]
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
241 then
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
242 if zstyle -T ":completion:${curcontext}:files" remote-access
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
243 then
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
244 local host=${PREFIX%%/*}
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
245 typeset -a remdirs
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
246 compset -p $(( $#host + 1 ))
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
247 local rempath=${(M)PREFIX##*/}
3602
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
248 local cacheid="hg:${host}-${rempath//\//_}"
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
249 cacheid=${cacheid%[-_]}
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
250 compset -P '*/'
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
251 if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
252 then
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
253 remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/})
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
254 _store_cache "$cacheid" remdirs
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
255 fi
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
256 _describe -t directories 'remote directory' remdirs -S/
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
257 else
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
258 _message 'remote directory'
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
259 fi
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
260 else
3602
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
261 if compset -P '*@'
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
262 then
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
263 _hosts -S/
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
264 else
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
265 _alternative 'hosts:remote host name:_hosts -S/' \
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
266 'users:user:_users -S@'
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
267 fi
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
268 fi
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
269 }
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
270
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
271 _hg_urls() {
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
272 if compset -P bundle://
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
273 then
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
274 _files
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
275 elif compset -P ssh://
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
276 then
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
277 _hg_ssh_urls
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
278 elif [[ -prefix *: ]]
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
279 then
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
280 _urls
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
281 else
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
282 local expl
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
283 compset -S '[^:]*'
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
284 _wanted url-schemas expl 'URL schema' compadd -S '' - \
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
285 http:// https:// ssh:// bundle://
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
286 fi
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
287 }
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
288
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
289 _hg_paths() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
290 typeset -a paths pnames
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
291 _hg_cmd paths 2> /dev/null | while read -A pnames
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
292 do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
293 paths+=($pnames[1])
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
294 done
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
295 (( $#paths )) && _describe -t path-aliases 'repository alias' paths
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
296 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
297
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
298 _hg_remote() {
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
299 _alternative 'path-aliases:repository alias:_hg_paths' \
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
300 'directories:directory:_files -/' \
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
301 'urls:URL:_hg_urls'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
302 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
303
3601
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
304 _hg_clone_dest() {
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
305 _alternative 'directories:directory:_files -/' \
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
306 'urls:URL:_hg_urls'
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
307 }
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
308
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
309 # Common options
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
310 _hg_global_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
311 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
312 '--cwd[change working directory]:new working directory:_files -/'
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
313 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
314 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
6804
694223a29ad4 Added missing --config global option to zsh_completion.
byron@base2.cc
parents: 5868
diff changeset
315 '*--config[set/override config option]:defined config items:_hg_config'
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
316 '(--quiet -q)'{-q,--quiet}'[suppress output]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
317 '(--help -h)'{-h,--help}'[display help and exit]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
318 '--debug[debug mode]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
319 '--debugger[start debugger]'
6804
694223a29ad4 Added missing --config global option to zsh_completion.
byron@base2.cc
parents: 5868
diff changeset
320 '--encoding[set the charset encoding (default: UTF8)]'
694223a29ad4 Added missing --config global option to zsh_completion.
byron@base2.cc
parents: 5868
diff changeset
321 '--encodingmode[set the charset encoding mode (default: strict)]'
694223a29ad4 Added missing --config global option to zsh_completion.
byron@base2.cc
parents: 5868
diff changeset
322 '--lsprof[print improved command execution profile]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
323 '--traceback[print traceback on exception]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
324 '--time[time how long the command takes]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
325 '--profile[profile]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
326 '--version[output version information and exit]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
327 )
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
328
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
329 _hg_pat_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
330 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
331 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
332
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
333 _hg_diff_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
334 '(--text -a)'{-a,--text}'[treat all files as text]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
335 '(--git -g)'{-g,--git}'[use git extended diff format]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
336 "--nodates[don't include dates in diff headers]")
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
337
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
338 _hg_dryrun_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
339 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
340
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
341 _hg_style_opts=(
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
342 '--style[display using template map file]:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
343 '--template[display with template]:')
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
344
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
345 _hg_commit_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
346 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
347 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
348 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
349
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
350 _hg_remote_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
351 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
352 '--remotecmd[specify hg command to run on the remote side]:')
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
353
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
354 _hg_cmd() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
355 _call_program hg hg "$_hg_cmd_globals[@]" "$@"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
356 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
357
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
358 _hg_cmd_add() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
359 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
360 '*:unknown files:_hg_unknown'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
361 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
362
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
363 _hg_cmd_addremove() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
364 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
365 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
366 '*:unknown or missing files:_hg_addremove'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
367 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
368
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
369 _hg_cmd_annotate() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
370 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
371 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
372 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
373 '(--text -a)'{-a,--text}'[treat all files as text]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
374 '(--user -u)'{-u,--user}'[list the author]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
375 '(--date -d)'{-d,--date}'[list the date]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
376 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
377 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
378 '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
379 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
380
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
381 _hg_cmd_archive() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
382 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
383 '--no-decode[do not pass files through decoders]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
384 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
385 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
386 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
387 '*:destination:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
388 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
389
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
390 _hg_cmd_backout() {
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
391 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
392 '--merge[merge with old dirstate parent after backout]' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
393 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
394 '--parent[parent to choose when backing out merge]' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
395 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
396 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
397 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
398 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
399 }
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
400
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
401 _hg_cmd_bundle() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
402 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
403 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
404 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
405 ':output file:_files' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
406 ':destination repository:_files -/'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
407 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
408
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
409 _hg_cmd_cat() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
410 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
411 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
412 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
413 '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
414 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
415
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
416 _hg_cmd_clone() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
417 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
418 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
419 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
420 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
421 ':source repository:_hg_remote' \
3601
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
422 ':destination:_hg_clone_dest'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
423 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
424
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
425 _hg_cmd_commit() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
426 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3666
adbf440a81e0 zsh: typo in commit completion
Brendan Cully <brendan@kublai.com>
parents: 3605
diff changeset
427 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
428 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
4441
2d3379c598c1 Fix issue 563: error in _hg_commit in the contrib/zsh_completion script.
Henri Precheur <henry@precheur.org>
parents: 3878
diff changeset
429 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
430 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
431 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
432 '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
433 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
434
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
435 _hg_cmd_copy() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
436 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
437 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
438 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
439 '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
440 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
441
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
442 _hg_cmd_diff() {
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
443 typeset -A opt_args
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
444 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
445 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
446 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
447 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
448 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
449 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
450 '*:file:->diff_files'
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
451
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
452 if [[ $state == 'diff_files' ]]
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
453 then
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
454 if [[ -n $opt_args[-r] ]]
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
455 then
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
456 _hg_files
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
457 else
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
458 _hg_modified
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
459 fi
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
460 fi
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
461 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
462
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
463 _hg_cmd_export() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
464 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
465 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
466 '--switch-parent[diff against the second parent]' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
467 '*:revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
468 }
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
469
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
470 _hg_cmd_grep() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
471 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
472 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
473 '--all[print all revisions with matches]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
474 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
475 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
476 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
477 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
478 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
479 '(--user -u)'{-u,--user}'[print user who committed change]' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
480 '1:search pattern:' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
481 '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
482 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
483
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
484 _hg_cmd_heads() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
485 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
486 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
487 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
488
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
489 _hg_cmd_help() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
490 _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
491 '*:mercurial command:_hg_commands'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
492 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
493
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
494 _hg_cmd_identify() {
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
495 _arguments -s -w : $_hg_global_opts \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
496 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_tags' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
497 '(--num -n)'{-n+,--num}'[show local revision number]' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
498 '(--id -i)'{-i+,--id}'[show global revision id]' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
499 '(--branch -b)'{-b+,--branch}'[show branch]' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
500 '(--tags -t)'{-t+,--tags}'[show tags]'
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
501 }
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
502
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
503 _hg_cmd_import() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
504 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
505 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
506 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
507 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
508 '*:patch:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
509 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
510
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
511 _hg_cmd_incoming() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
512 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
513 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
514 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
515 '(--patch -p)'{-p,--patch}'[show patch]' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
516 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
517 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
518 '--bundle[file to store the bundles into]:bundle file:_files' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
519 ':source:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
520 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
521
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
522 _hg_cmd_init() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
523 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
524 ':dir:_files -/'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
525 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
526
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
527 _hg_cmd_locate() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
528 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
529 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
530 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
531 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
532 '*:search pattern:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
533 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
534
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
535 _hg_cmd_log() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
536 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
537 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
538 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
539 '(--copies -C)'{-C,--copies}'[show copied files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
540 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
541 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
542 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
543 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
544 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
545 '(--patch -p)'{-p,--patch}'[show patch]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
546 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
547 '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
548 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
549
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
550 _hg_cmd_manifest() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
551 _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
552 ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
553 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
554
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
555 _hg_cmd_outgoing() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
556 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
557 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
558 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
559 '(--patch -p)'{-p,--patch}'[show patch]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
560 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
561 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
562 ':destination:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
563 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
564
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
565 _hg_cmd_parents() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
566 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
567 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
568 ':last modified file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
569 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
570
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
571 _hg_cmd_paths() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
572 _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
573 ':path:_hg_paths'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
574 }
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
575
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
576 _hg_cmd_pull() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
577 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
578 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
579 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
580 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
581 ':source:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
582 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
583
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
584 _hg_cmd_push() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
585 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
586 '(--force -f)'{-f,--force}'[force push]' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
587 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
588 ':destination:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
589 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
590
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
591 _hg_cmd_remove() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
592 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
593 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
594 '(--force -f)'{-f,--force}'[remove file even if modified]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
595 '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
596 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
597
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
598 _hg_cmd_rename() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
599 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
600 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
601 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
602 '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
603 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
604
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
605 _hg_cmd_resolve() {
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
606 local context state line
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
607 typeset -A opt_args
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
608
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
609 _arguments -s -w : $_hg_global_opts \
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
610 '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
611 '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
7386
86bfd65532ac zsh: make resolve with no options only complete unresolved files
Brendan Cully <brendan@kublai.com>
parents: 7384
diff changeset
612 '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
86bfd65532ac zsh: make resolve with no options only complete unresolved files
Brendan Cully <brendan@kublai.com>
parents: 7384
diff changeset
613 '*:file:_hg_unresolved'
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
614
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
615 if [[ $state == 'resolve_files' ]]
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
616 then
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
617 _alternative 'files:resolved files:_hg_resolved' \
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
618 'files:unresolved files:_hg_unresolved'
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
619 fi
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
620 }
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
621
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
622 _hg_cmd_revert() {
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
623 local context state line
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
624 typeset -A opt_args
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
625
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
626 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
627 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
628 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
629 '--no-backup[do not save backup copies of files]' \
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
630 '*:file:->diff_files'
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
631
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
632 if [[ $state == 'diff_files' ]]
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
633 then
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
634 if [[ -n $opt_args[-r] ]]
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
635 then
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
636 _hg_files
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
637 else
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
638 typeset -a status_files
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
639 _hg_status mard
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
640 _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
641 fi
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
642 fi
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
643 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
644
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
645 _hg_cmd_serve() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
646 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
647 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
648 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
649 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
650 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
651 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
652 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
653 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
654 '--style[web template style]:style' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
655 '--stdio[for remote clients]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
656 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
657 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
658
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
659 _hg_cmd_showconfig() {
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
660 _arguments -s -w : $_hg_global_opts \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
661 '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
662 ':config item:_hg_config'
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
663 }
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
664
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
665 _hg_cmd_status() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
666 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
667 '(--all -A)'{-A,--all}'[show status of all files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
668 '(--modified -m)'{-m,--modified}'[show only modified files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
669 '(--added -a)'{-a,--added}'[show only added files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
670 '(--removed -r)'{-r,--removed}'[show only removed files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
671 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
672 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
673 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
674 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
675 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
676 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
677 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
678 '--rev[show difference from revision]:revision:_hg_tags' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
679 '*:files:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
680 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
681
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
682 _hg_cmd_tag() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
683 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
684 '(--local -l)'{-l,--local}'[make the tag local]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
685 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
686 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
687 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
688 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
689 ':tag name:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
690 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
691
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
692 _hg_cmd_tip() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
693 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
694 '(--patch -p)'{-p,--patch}'[show patch]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
695 }
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
696
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
697 _hg_cmd_unbundle() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
698 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
699 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
700 ':files:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
701 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
702
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
703 _hg_cmd_update() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
704 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
705 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
706 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
707 ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
708 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
709
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
710 # bisect extension
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
711 _hg_cmd_bisect() {
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
712 _arguments -s -w : $_hg_global_opts ':evaluation:(help init reset next good bad)'
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
713 }
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
714
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
715 # HGK
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
716 _hg_cmd_view() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
717 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
718 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
719 ':revision range:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
720 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
721
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
722 # MQ
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
723 _hg_qseries() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
724 typeset -a patches
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
725 patches=(${(f)"$(_hg_cmd qseries 2>/dev/null)"})
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
726 (( $#patches )) && _describe -t hg-patches 'patches' patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
727 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
728
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
729 _hg_qapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
730 typeset -a patches
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
731 patches=(${(f)"$(_hg_cmd qapplied 2>/dev/null)"})
3549
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
732 if (( $#patches ))
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
733 then
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
734 patches+=(qbase qtip)
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
735 _describe -t hg-applied-patches 'applied patches' patches
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
736 fi
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
737 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
738
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
739 _hg_qunapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
740 typeset -a patches
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
741 patches=(${(f)"$(_hg_cmd qunapplied 2>/dev/null)"})
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
742 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
743 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
744
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
745 _hg_qguards() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
746 typeset -a guards
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
747 local guard
3543
fe9c1e886b5e zsh: complete qguard with +/- guard prefixes
Brendan Cully <brendan@kublai.com>
parents: 3541
diff changeset
748 compset -P "+|-"
3559
35b99f076d02 zsh: suppress mq completion error messages outside of repository
Brendan Cully <brendan@kublai.com>
parents: 3558
diff changeset
749 _hg_cmd qselect -s 2>/dev/null | while read guard
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
750 do
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
751 guards+=(${guard#(+|-)})
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
752 done
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
753 (( $#guards )) && _describe -t hg-guards 'guards' guards
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
754 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
755
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
756 _hg_qseries_opts=(
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
757 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
758
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
759 _hg_cmd_qapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
760 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
761 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
762
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
763 _hg_cmd_qdelete() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
764 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
765 '(--keep -k)'{-k,--keep}'[keep patch file]' \
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
766 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
767 '*:unapplied patch:_hg_qunapplied'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
768 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
769
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
770 _hg_cmd_qdiff() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
771 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
772 '*:pattern:_hg_files'
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
773 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
774
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
775 _hg_cmd_qfold() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
776 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
777 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
778 '*:unapplied patch:_hg_qunapplied'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
779 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
780
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
781 _hg_cmd_qgoto() {
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
782 _arguments -s -w : $_hg_global_opts \
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
783 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
784 ':patch:_hg_qseries'
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
785 }
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
786
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
787 _hg_cmd_qguard() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
788 _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
789 '(--list -l)'{-l,--list}'[list all patches and guards]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
790 '(--none -n)'{-n,--none}'[drop all guards]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
791 ':patch:_hg_qseries' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
792 '*:guards:_hg_qguards'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
793 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
794
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
795 _hg_cmd_qheader() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
796 _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
797 ':patch:_hg_qseries'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
798 }
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
799
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
800 _hg_cmd_qimport() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
801 _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
802 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
803 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
804 '(--force -f)'{-f,--force}'[overwrite existing files]' \
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
805 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
806 '*:patch:_files'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
807 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
808
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
809 _hg_cmd_qnew() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
810 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
811 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
812 ':patch:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
813 }
1368
d1d605d1e839 Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents: 1365
diff changeset
814
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
815 _hg_cmd_qnext() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
816 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
817 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
818
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
819 _hg_cmd_qpop() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
820 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
821 '(--all -a :)'{-a,--all}'[pop all patches]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
822 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
823 '(--force -f)'{-f,--force}'[forget any local changes]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
824 ':patch:_hg_qapplied'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
825 }
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
826
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
827 _hg_cmd_qprev() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
828 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
829 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
830
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
831 _hg_cmd_qpush() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
832 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
833 '(--all -a :)'{-a,--all}'[apply all patches]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
834 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
835 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
836 '(--name -n)'{-n+,--name}'[merge queue name]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
837 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
838 ':patch:_hg_qunapplied'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
839 }
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
840
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
841 _hg_cmd_qrefresh() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
842 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
843 '(--git -g)'{-g,--git}'[use git extended diff format]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
844 '(--short -s)'{-s,--short}'[short refresh]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
845 '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
846 }
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
847
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
848 _hg_cmd_qrename() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
849 _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
850 ':patch:_hg_qseries' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
851 ':destination:'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
852 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
853
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
854 _hg_cmd_qselect() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
855 _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
856 '(--none -n :)'{-n,--none}'[disable all guards]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
857 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
858 '--pop[pop to before first guarded applied patch]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
859 '--reapply[pop and reapply patches]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
860 '*:guards:_hg_qguards'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
861 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
862
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
863 _hg_cmd_qseries() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
864 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
865 '(--missing -m)'{-m,--missing}'[print patches not in series]'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
866 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
867
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
868 _hg_cmd_qunapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
869 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
870 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
871
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
872 _hg_cmd_qtop() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
873 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
874 }
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
875
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
876 _hg_cmd_strip() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
877 _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
878 '(--force -f)'{-f,--force}'[force multi-head removal]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
879 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
880 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
881 ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
882 }
3493
1b9494d2b070 zsh: expand tags lazily
Brendan Cully <brendan@kublai.com>
parents: 3487
diff changeset
883
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
884 _hg "$@"