##// END OF EJS Templates
zsh: use standard tags where possible
Brendan Cully -
r3548:811e6c95 default
parent child Browse files
Show More
@@ -1,652 +1,651 b''
1 #compdef hg
1 #compdef hg
2
2
3 # Zsh completion script for mercurial. Rename this file to _hg and copy
3 # Zsh completion script for mercurial. Rename this file to _hg and copy
4 # it into your zsh function path (/usr/share/zsh/site-functions for
4 # it into your zsh function path (/usr/share/zsh/site-functions for
5 # instance)
5 # instance)
6 #
6 #
7 # Copyright (C) 2005 Steve Borho
7 # Copyright (C) 2005 Steve Borho
8 # Copyright (C) 2006 Brendan Cully
8 # Copyright (C) 2006 Brendan Cully <brendan@kublai.com>
9 #
9 #
10 # This is free software; you can redistribute it and/or modify it under
10 # This is free software; you can redistribute it and/or modify it under
11 # the terms of the GNU General Public License as published by the Free
11 # the terms of the GNU General Public License as published by the Free
12 # Software Foundation; either version 2 of the License, or (at your
12 # Software Foundation; either version 2 of the License, or (at your
13 # option) any later version.
13 # option) any later version.
14 #
14 #
15
15
16 local curcontext="$curcontext" state line
16 local curcontext="$curcontext" state line
17 local repos newFiles addedFiles commitMessage
18 typeset -A _hg_cmd_globals
17 typeset -A _hg_cmd_globals
19
18
20 _hg() {
19 _hg() {
21 local cmd
20 local cmd
22 integer i=2
21 integer i=2
23 _hg_cmd_globals=()
22 _hg_cmd_globals=()
24
23
25 while (( i < $#words ))
24 while (( i < $#words ))
26 do
25 do
27 case "$words[$i]" in
26 case "$words[$i]" in
28 -R|--repository|--cwd|--config)
27 -R|--repository|--cwd|--config)
29 # pass along arguments to hg completer
28 # pass along arguments to hg completer
30 _hg_cmd_globals+="$words[$i]"
29 _hg_cmd_globals+="$words[$i]"
31 _hg_cmd_globals+="$words[$i+1]"
30 _hg_cmd_globals+="$words[$i+1]"
32 (( i += 2 ))
31 (( i += 2 ))
33 continue
32 continue
34 ;;
33 ;;
35 -R*)
34 -R*)
36 _hg_cmd_globals+="$words[$i]"
35 _hg_cmd_globals+="$words[$i]"
37 (( i++ ))
36 (( i++ ))
38 continue
37 continue
39 ;;
38 ;;
40 -*)
39 -*)
41 # skip option
40 # skip option
42 (( i++ ))
41 (( i++ ))
43 continue
42 continue
44 ;;
43 ;;
45 esac
44 esac
46 if [[ -z "$cmd" ]]
45 if [[ -z "$cmd" ]]
47 then
46 then
48 cmd="$words[$i]"
47 cmd="$words[$i]"
49 words[$i]=()
48 words[$i]=()
50 (( CURRENT-- ))
49 (( CURRENT-- ))
51 fi
50 fi
52 (( i++ ))
51 (( i++ ))
53 done
52 done
54
53
55 if [[ -z "$cmd" ]]
54 if [[ -z "$cmd" ]]
56 then
55 then
57 _arguments -s -w : $_hg_global_opts \
56 _arguments -s -w : $_hg_global_opts \
58 ':mercurial command:_hg_commands'
57 ':mercurial command:_hg_commands'
59 return
58 return
60 fi
59 fi
61
60
62 # resolve abbreviations and aliases
61 # resolve abbreviations and aliases
63 if ! (( $+functions[_hg_cmd_${cmd}] ))
62 if ! (( $+functions[_hg_cmd_${cmd}] ))
64 then
63 then
65 local cmdexp
64 local cmdexp
66 (( $#_hg_cmd_list )) || _hg_get_commands
65 (( $#_hg_cmd_list )) || _hg_get_commands
67
66
68 cmdexp=$_hg_cmd_list[(r)${cmd}*]
67 cmdexp=$_hg_cmd_list[(r)${cmd}*]
69 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
68 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
70 then
69 then
71 # might be nice to rewrite the command line with the expansion
70 # might be nice to rewrite the command line with the expansion
72 cmd="$cmdexp"
71 cmd="$cmdexp"
73 fi
72 fi
74 if [[ -n $_hg_alias_list[$cmd] ]]
73 if [[ -n $_hg_alias_list[$cmd] ]]
75 then
74 then
76 cmd=$_hg_alias_list[$cmd]
75 cmd=$_hg_alias_list[$cmd]
77 fi
76 fi
78 fi
77 fi
79
78
80 if (( $+functions[_hg_cmd_${cmd}] ))
79 if (( $+functions[_hg_cmd_${cmd}] ))
81 then
80 then
82 curcontext="${curcontext%:*:*}:hg-${cmd}:"
81 curcontext="${curcontext%:*:*}:hg-${cmd}:"
83 _hg_cmd_${cmd}
82 _hg_cmd_${cmd}
84 return
83 return
85 fi
84 fi
86 }
85 }
87
86
88 _hg_get_commands() {
87 _hg_get_commands() {
89 typeset -ga _hg_cmd_list
88 typeset -ga _hg_cmd_list
90 typeset -gA _hg_alias_list
89 typeset -gA _hg_alias_list
91 local hline cmd cmdalias
90 local hline cmd cmdalias
92 _call_program help hg --verbose help | while read -A hline
91 _call_program help hg --verbose help | while read -A hline
93 do
92 do
94 cmd="$hline[1]"
93 cmd="$hline[1]"
95 case $cmd in
94 case $cmd in
96 *:)
95 *:)
97 cmd=${cmd%:}
96 cmd=${cmd%:}
98 _hg_cmd_list+=($cmd)
97 _hg_cmd_list+=($cmd)
99 ;;
98 ;;
100 *,)
99 *,)
101 cmd=${cmd%,}
100 cmd=${cmd%,}
102 _hg_cmd_list+=($cmd)
101 _hg_cmd_list+=($cmd)
103 integer i=2
102 integer i=2
104 while (( i <= $#hline ))
103 while (( i <= $#hline ))
105 do
104 do
106 cmdalias=${hline[$i]%(:|,)}
105 cmdalias=${hline[$i]%(:|,)}
107 _hg_cmd_list+=($cmdalias)
106 _hg_cmd_list+=($cmdalias)
108 _hg_alias_list+=($cmdalias $cmd)
107 _hg_alias_list+=($cmdalias $cmd)
109 (( i++ ))
108 (( i++ ))
110 done
109 done
111 ;;
110 ;;
112 esac
111 esac
113 done
112 done
114 }
113 }
115
114
116 _hg_commands() {
115 _hg_commands() {
117 (( $#_hg_cmd_list )) || _hg_get_commands
116 (( $#_hg_cmd_list )) || _hg_get_commands
118 _describe -t hg-commands 'mercurial command' _hg_cmd_list
117 _describe -t commands 'mercurial command' _hg_cmd_list
119 }
118 }
120
119
121 _hg_tags() {
120 _hg_tags() {
122 typeset -a tags
121 typeset -a tags
123 local tag rev
122 local tag rev
124
123
125 _hg_cmd tags 2> /dev/null | while read tag rev
124 _hg_cmd tags 2> /dev/null | while read tag rev
126 do
125 do
127 tags+=($tag)
126 tags+=($tag)
128 done
127 done
129 (( $#tags )) && _describe -t hg-tags 'tags' tags
128 (( $#tags )) && _describe -t tags 'tags' tags
130 }
129 }
131
130
132 _hg_status() {
131 _hg_status() {
133 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"})
132 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"})
134 }
133 }
135
134
136 _hg_unknown() {
135 _hg_unknown() {
137 typeset -a status_files
136 typeset -a status_files
138 _hg_status u
137 _hg_status u
139 (( $#status_files )) && _describe -t hg-unknown-files 'unknown files' status_files
138 (( $#status_files )) && _describe -t files 'unknown files' status_files
140 }
139 }
141
140
142 _hg_missing() {
141 _hg_missing() {
143 typeset -a status_files
142 typeset -a status_files
144 _hg_status d
143 _hg_status d
145 (( $#status_files )) && _describe -t hg-missing-files 'missing files' status_files
144 (( $#status_files )) && _describe -t files 'missing files' status_files
146 }
145 }
147
146
148 _hg_addremove() {
147 _hg_addremove() {
149 _alternative "unknown files:unknown files:_hg_unknown" \
148 _alternative 'files:unknown files:_hg_unknown' \
150 "missing files:missing files:_hg_missing"
149 'files:missing files:_hg_missing'
151 }
150 }
152
151
153 _hg_paths() {
152 _hg_paths() {
154 typeset -a paths pnames
153 typeset -a paths pnames
155 _hg_cmd paths 2> /dev/null | while read -A pnames
154 _hg_cmd paths 2> /dev/null | while read -A pnames
156 do
155 do
157 paths+=($pnames[1])
156 paths+=($pnames[1])
158 done
157 done
159 (( $#paths )) && _describe -t hg-paths 'repository aliases' paths
158 (( $#paths )) && _describe -t urls 'repository aliases' paths
160 }
159 }
161
160
162 _hg_remote() {
161 _hg_remote() {
163 _alternative 'repository aliases:repository aliases:_hg_paths' \
162 _alternative 'urls:repository alias:_hg_paths' \
164 'directory:directory:_files -/'
163 'directories:directory:_files -/'
165 }
164 }
166
165
167 # Common options
166 # Common options
168 _hg_global_opts=(
167 _hg_global_opts=(
169 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
168 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
170 '--cwd[change working directory]:new working directory:_files -/'
169 '--cwd[change working directory]:new working directory:_files -/'
171 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
170 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
172 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
171 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
173 '(--quiet -q)'{-q,--quiet}'[suppress output]'
172 '(--quiet -q)'{-q,--quiet}'[suppress output]'
174 '(--help -h)'{-h,--help}'[display help and exit]'
173 '(--help -h)'{-h,--help}'[display help and exit]'
175 '--debug[debug mode]'
174 '--debug[debug mode]'
176 '--debugger[start debugger]'
175 '--debugger[start debugger]'
177 '--traceback[print traceback on exception]'
176 '--traceback[print traceback on exception]'
178 '--time[time how long the command takes]'
177 '--time[time how long the command takes]'
179 '--profile[profile]'
178 '--profile[profile]'
180 '--version[output version information and exit]'
179 '--version[output version information and exit]'
181 )
180 )
182
181
183 _hg_pat_opts=(
182 _hg_pat_opts=(
184 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
183 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
185 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
184 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
186
185
187 _hg_diff_opts=(
186 _hg_diff_opts=(
188 '(--text -a)'{-a,--text}'[treat all files as text]'
187 '(--text -a)'{-a,--text}'[treat all files as text]'
189 '(--git -g)'{-g,--git}'[use git extended diff format]'
188 '(--git -g)'{-g,--git}'[use git extended diff format]'
190 "--nodates[don't include dates in diff headers]")
189 "--nodates[don't include dates in diff headers]")
191
190
192 _hg_dryrun_opts=(
191 _hg_dryrun_opts=(
193 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
192 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
194
193
195 _hg_style_opts=(
194 _hg_style_opts=(
196 '--style[display using template map file]:'
195 '--style[display using template map file]:'
197 '--template[display with template]:')
196 '--template[display with template]:')
198
197
199 _hg_commit_opts=(
198 _hg_commit_opts=(
200 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
199 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
201 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
200 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
202 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
201 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
203
202
204 _hg_remote_opts=(
203 _hg_remote_opts=(
205 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
204 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
206 '--remotecmd[specify hg command to run on the remote side]:')
205 '--remotecmd[specify hg command to run on the remote side]:')
207
206
208 _hg_cmd() {
207 _hg_cmd() {
209 _call_program hg hg "$_hg_cmd_globals[@]" "$@"
208 _call_program hg hg "$_hg_cmd_globals[@]" "$@"
210 }
209 }
211
210
212 _hg_cmd_add() {
211 _hg_cmd_add() {
213 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
212 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
214 '*:unknown files:_hg_unknown'
213 '*:unknown files:_hg_unknown'
215 }
214 }
216
215
217 _hg_cmd_addremove() {
216 _hg_cmd_addremove() {
218 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
217 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
219 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
218 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
220 '*:unknown or missing files:_hg_addremove'
219 '*:unknown or missing files:_hg_addremove'
221 }
220 }
222
221
223 _hg_cmd_annotate() {
222 _hg_cmd_annotate() {
224 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
223 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
225 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
224 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
226 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
225 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
227 '(--text -a)'{-a,--text}'[treat all files as text]' \
226 '(--text -a)'{-a,--text}'[treat all files as text]' \
228 '(--user -u)'{-u,--user}'[list the author]' \
227 '(--user -u)'{-u,--user}'[list the author]' \
229 '(--date -d)'{-d,--date}'[list the date]' \
228 '(--date -d)'{-d,--date}'[list the date]' \
230 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
229 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
231 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
230 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
232 '*:files:_files -W $(_hg_cmd root)'
231 '*:files:_files -W $(_hg_cmd root)'
233 }
232 }
234
233
235 _hg_cmd_archive() {
234 _hg_cmd_archive() {
236 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
235 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
237 '--no-decode[do not pass files through decoders]' \
236 '--no-decode[do not pass files through decoders]' \
238 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
237 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
239 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
238 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
240 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
239 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
241 '*:destination:_files'
240 '*:destination:_files'
242 }
241 }
243
242
244 _hg_cmd_bundle() {
243 _hg_cmd_bundle() {
245 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
244 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
246 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
245 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
247 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
246 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
248 ':output file:_files' \
247 ':output file:_files' \
249 ':destination repository:_files -/'
248 ':destination repository:_files -/'
250 }
249 }
251
250
252 _hg_cmd_cat() {
251 _hg_cmd_cat() {
253 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
252 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
254 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
253 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
255 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
254 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
256 '*:file:_files -W $(_hg_cmd root)'
255 '*:file:_files -W $(_hg_cmd root)'
257 }
256 }
258
257
259 _hg_cmd_clone() {
258 _hg_cmd_clone() {
260 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
259 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
261 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
260 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
262 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
261 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
263 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
262 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
264 ':source repository:_hg_remote' \
263 ':source repository:_hg_remote' \
265 ':destination:_files -/'
264 ':destination:_files -/'
266 }
265 }
267
266
268 _hg_cmd_commit() {
267 _hg_cmd_commit() {
269 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
268 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
270 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]'
269 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]'
271 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
270 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
272 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \
271 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \
273 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
272 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
274 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
273 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
275 '*:file:_files -W $(_hg_cmd root)'
274 '*:file:_files -W $(_hg_cmd root)'
276 }
275 }
277
276
278 _hg_cmd_copy() {
277 _hg_cmd_copy() {
279 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
278 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
280 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
279 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
281 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
280 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
282 '*:file:_files -W $(_hg_cmd root)'
281 '*:file:_files -W $(_hg_cmd root)'
283 }
282 }
284
283
285 _hg_cmd_diff() {
284 _hg_cmd_diff() {
286 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
285 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
287 '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \
286 '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \
288 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
287 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
289 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
288 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
290 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
289 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
291 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
290 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
292 '*:file:_files -W $(_hg_cmd root)'
291 '*:file:_files -W $(_hg_cmd root)'
293 }
292 }
294
293
295 _hg_cmd_export() {
294 _hg_cmd_export() {
296 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
295 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
297 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
296 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
298 '--switch-parent[diff against the second parent]' \
297 '--switch-parent[diff against the second parent]' \
299 '*:revision:_hg_tags'
298 '*:revision:_hg_tags'
300 }
299 }
301
300
302 _hg_cmd_grep() {
301 _hg_cmd_grep() {
303 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
302 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
304 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
303 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
305 '--all[print all revisions with matches]' \
304 '--all[print all revisions with matches]' \
306 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
305 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
307 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
306 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
308 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
307 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
309 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
308 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
310 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \
309 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \
311 '(--user -u)'{-u,--user}'[print user who committed change]' \
310 '(--user -u)'{-u,--user}'[print user who committed change]' \
312 '*:search pattern:_files -W $(_hg_cmd root)'
311 '*:search pattern:_files -W $(_hg_cmd root)'
313 }
312 }
314
313
315 _hg_cmd_heads() {
314 _hg_cmd_heads() {
316 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
315 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
317 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
316 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
318 }
317 }
319
318
320 _hg_cmd_help() {
319 _hg_cmd_help() {
321 _arguments -s -w : $_hg_global_opts \
320 _arguments -s -w : $_hg_global_opts \
322 '*:mercurial command:_hg_commands'
321 '*:mercurial command:_hg_commands'
323 }
322 }
324
323
325 _hg_cmd_import() {
324 _hg_cmd_import() {
326 _arguments -s -w : $_hg_global_opts \
325 _arguments -s -w : $_hg_global_opts \
327 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
326 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
328 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
327 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
329 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
328 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
330 '*:patch:_files'
329 '*:patch:_files'
331 }
330 }
332
331
333 _hg_cmd_incoming() {
332 _hg_cmd_incoming() {
334 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
333 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
335 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
334 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
336 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
335 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
337 '(--patch -p)'{-p,--patch}'[show patch]' \
336 '(--patch -p)'{-p,--patch}'[show patch]' \
338 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \
337 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \
339 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
338 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
340 '--bundle[file to store the bundles into]:bundle file:_files' \
339 '--bundle[file to store the bundles into]:bundle file:_files' \
341 ':source:_hg_remote'
340 ':source:_hg_remote'
342 }
341 }
343
342
344 _hg_cmd_init() {
343 _hg_cmd_init() {
345 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
344 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
346 ':dir:_files -/'
345 ':dir:_files -/'
347 }
346 }
348
347
349 _hg_cmd_locate() {
348 _hg_cmd_locate() {
350 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
349 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
351 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
350 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
352 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
351 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
353 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
352 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
354 '*:search pattern:_files -W $(_hg_cmd root)'
353 '*:search pattern:_files -W $(_hg_cmd root)'
355 }
354 }
356
355
357 _hg_cmd_log() {
356 _hg_cmd_log() {
358 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
357 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
359 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
358 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
360 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
359 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
361 '(--copies -C)'{-C,--copies}'[show copied files]' \
360 '(--copies -C)'{-C,--copies}'[show copied files]' \
362 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
361 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
363 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
362 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
364 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \
363 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \
365 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
364 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
366 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
365 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
367 '(--patch -p)'{-p,--patch}'[show patch]' \
366 '(--patch -p)'{-p,--patch}'[show patch]' \
368 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
367 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
369 '*:files:_files -W $(_hg_cmd root)'
368 '*:files:_files -W $(_hg_cmd root)'
370 }
369 }
371
370
372 _hg_cmd_manifest() {
371 _hg_cmd_manifest() {
373 _arguments -s -w : $_hg_global_opts \
372 _arguments -s -w : $_hg_global_opts \
374 ':revision:_hg_tags'
373 ':revision:_hg_tags'
375 }
374 }
376
375
377 _hg_cmd_outgoing() {
376 _hg_cmd_outgoing() {
378 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
377 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
379 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
378 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
380 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
379 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
381 '(--patch -p)'{-p,--patch}'[show patch]' \
380 '(--patch -p)'{-p,--patch}'[show patch]' \
382 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
381 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
383 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
382 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
384 ':destination:_hg_remote'
383 ':destination:_hg_remote'
385 }
384 }
386
385
387 _hg_cmd_parents() {
386 _hg_cmd_parents() {
388 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
387 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
389 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
388 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
390 ':revision:_hg_tags'
389 ':revision:_hg_tags'
391 }
390 }
392
391
393 _hg_cmd_paths() {
392 _hg_cmd_paths() {
394 _arguments -s -w : $_hg_global_opts \
393 _arguments -s -w : $_hg_global_opts \
395 ':path:_hg_paths'
394 ':path:_hg_paths'
396 }
395 }
397
396
398 _hg_cmd_pull() {
397 _hg_cmd_pull() {
399 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
398 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
400 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
399 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
401 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
400 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
402 ':source:_hg_remote'
401 ':source:_hg_remote'
403 }
402 }
404
403
405 _hg_cmd_push() {
404 _hg_cmd_push() {
406 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
405 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
407 '(--force -f)'{-f,--force}'[force push]' \
406 '(--force -f)'{-f,--force}'[force push]' \
408 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
407 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
409 ':destination:_hg_remote'
408 ':destination:_hg_remote'
410 }
409 }
411
410
412 _hg_cmd_remove() {
411 _hg_cmd_remove() {
413 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
412 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
414 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
413 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
415 '(--force -f)'{-f,--force}'[remove file even if modified]' \
414 '(--force -f)'{-f,--force}'[remove file even if modified]' \
416 '*:file:_files -W $(_hg_cmd root)'
415 '*:file:_files -W $(_hg_cmd root)'
417 }
416 }
418
417
419 _hg_cmd_rename() {
418 _hg_cmd_rename() {
420 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
419 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
421 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
420 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
422 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
421 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
423 '*:file:_files -W $(_hg_cmd root)'
422 '*:file:_files -W $(_hg_cmd root)'
424 }
423 }
425
424
426 _hg_cmd_revert() {
425 _hg_cmd_revert() {
427 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
426 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
428 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
427 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
429 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
428 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
430 '--no-backup[do not save backup copies of files]' \
429 '--no-backup[do not save backup copies of files]' \
431 '*:file:_files -W $(_hg_cmd root)'
430 '*:file:_files -W $(_hg_cmd root)'
432 }
431 }
433
432
434 _hg_cmd_serve() {
433 _hg_cmd_serve() {
435 _arguments -s -w : $_hg_global_opts \
434 _arguments -s -w : $_hg_global_opts \
436 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
435 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
437 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
436 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
438 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
437 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
439 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
438 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
440 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
439 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
441 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
440 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
442 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
441 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
443 '--style[web template style]:style' \
442 '--style[web template style]:style' \
444 '--stdio[for remote clients]' \
443 '--stdio[for remote clients]' \
445 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
444 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
446 }
445 }
447
446
448 _hg_cmd_status() {
447 _hg_cmd_status() {
449 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
448 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
450 '(--all -A)'{-A,--all}'[show status of all files]' \
449 '(--all -A)'{-A,--all}'[show status of all files]' \
451 '(--modified -m)'{-m,--modified}'[show only modified files]' \
450 '(--modified -m)'{-m,--modified}'[show only modified files]' \
452 '(--added -a)'{-a,--added}'[show only added files]' \
451 '(--added -a)'{-a,--added}'[show only added files]' \
453 '(--removed -r)'{-r,--removed}'[show only removed files]' \
452 '(--removed -r)'{-r,--removed}'[show only removed files]' \
454 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
453 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
455 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
454 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
456 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
455 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
457 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
456 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
458 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
457 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
459 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
458 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
460 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
459 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
461 '--rev[show difference from revision]:revision:_hg_tags' \
460 '--rev[show difference from revision]:revision:_hg_tags' \
462 '*:files:_files'
461 '*:files:_files'
463 }
462 }
464
463
465 _hg_cmd_tag() {
464 _hg_cmd_tag() {
466 _arguments -s -w : $_hg_global_opts \
465 _arguments -s -w : $_hg_global_opts \
467 '(--local -l)'{-l,--local}'[make the tag local]' \
466 '(--local -l)'{-l,--local}'[make the tag local]' \
468 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
467 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
469 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
468 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
470 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
469 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
471 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
470 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
472 ':tag name:'
471 ':tag name:'
473 }
472 }
474
473
475 _hg_cmd_tip() {
474 _hg_cmd_tip() {
476 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
475 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
477 '(--patch -p)'{-p,--patch}'[show patch]'
476 '(--patch -p)'{-p,--patch}'[show patch]'
478 }
477 }
479
478
480 _hg_cmd_unbundle() {
479 _hg_cmd_unbundle() {
481 _arguments -s -w : $_hg_global_opts \
480 _arguments -s -w : $_hg_global_opts \
482 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
481 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
483 ':files:_files'
482 ':files:_files'
484 }
483 }
485
484
486 _hg_cmd_update() {
485 _hg_cmd_update() {
487 _arguments -s -w : $_hg_global_opts \
486 _arguments -s -w : $_hg_global_opts \
488 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
487 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
489 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
488 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
490 ':revision:_hg_tags'
489 ':revision:_hg_tags'
491 }
490 }
492
491
493 # HGK
492 # HGK
494 _hg_cmd_view() {
493 _hg_cmd_view() {
495 _arguments -s -w : $_hg_global_opts \
494 _arguments -s -w : $_hg_global_opts \
496 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
495 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
497 ':revision range:_hg_tags'
496 ':revision range:_hg_tags'
498 }
497 }
499
498
500 # MQ
499 # MQ
501 _hg_qseries() {
500 _hg_qseries() {
502 typeset -a patches
501 typeset -a patches
503 patches=($(_hg_cmd qseries))
502 patches=($(_hg_cmd qseries))
504 (( $#patches )) && _describe -t hg-patches 'patches' patches
503 (( $#patches )) && _describe -t hg-patches 'patches' patches
505 }
504 }
506
505
507 _hg_qapplied() {
506 _hg_qapplied() {
508 typeset -a patches
507 typeset -a patches
509 patches=($(_hg_cmd qapplied))
508 patches=($(_hg_cmd qapplied))
510 (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches
509 (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches
511 }
510 }
512
511
513 _hg_qunapplied() {
512 _hg_qunapplied() {
514 typeset -a patches
513 typeset -a patches
515 patches=($(_hg_cmd qunapplied))
514 patches=($(_hg_cmd qunapplied))
516 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
515 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
517 }
516 }
518
517
519 _hg_qguards() {
518 _hg_qguards() {
520 typeset -a guards
519 typeset -a guards
521 local guard
520 local guard
522 compset -P "+|-"
521 compset -P "+|-"
523 _hg_cmd qselect -s | while read guard
522 _hg_cmd qselect -s | while read guard
524 do
523 do
525 guards+=(${guard#(+|-)})
524 guards+=(${guard#(+|-)})
526 done
525 done
527 (( $#guards )) && _describe -t hg-guards 'guards' guards
526 (( $#guards )) && _describe -t hg-guards 'guards' guards
528 }
527 }
529
528
530 _hg_qseries_opts=(
529 _hg_qseries_opts=(
531 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
530 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
532
531
533 _hg_cmd_qapplied() {
532 _hg_cmd_qapplied() {
534 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
533 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
535 }
534 }
536
535
537 _hg_cmd_qdelete() {
536 _hg_cmd_qdelete() {
538 _arguments -s -w : $_hg_global_opts \
537 _arguments -s -w : $_hg_global_opts \
539 '(--keep -k)'{-k,--keep}'[keep patch file]' \
538 '(--keep -k)'{-k,--keep}'[keep patch file]' \
540 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \
539 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \
541 '*:unapplied patch:_hg_qunapplied'
540 '*:unapplied patch:_hg_qunapplied'
542 }
541 }
543
542
544 _hg_cmd_qdiff() {
543 _hg_cmd_qdiff() {
545 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
544 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
546 '*:pattern:_files -W $(_hg_cmd root)'
545 '*:pattern:_files -W $(_hg_cmd root)'
547 }
546 }
548
547
549 _hg_cmd_qfold() {
548 _hg_cmd_qfold() {
550 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
549 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
551 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
550 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
552 '*:unapplied patch:_hg_qunapplied'
551 '*:unapplied patch:_hg_qunapplied'
553 }
552 }
554
553
555 _hg_cmd_qguard() {
554 _hg_cmd_qguard() {
556 _arguments -s -w : $_hg_global_opts \
555 _arguments -s -w : $_hg_global_opts \
557 '(--list -l)'{-l,--list}'[list all patches and guards]' \
556 '(--list -l)'{-l,--list}'[list all patches and guards]' \
558 '(--none -n)'{-n,--none}'[drop all guards]' \
557 '(--none -n)'{-n,--none}'[drop all guards]' \
559 ':patch:_hg_qseries' \
558 ':patch:_hg_qseries' \
560 '*:guards:_hg_qguards'
559 '*:guards:_hg_qguards'
561 }
560 }
562
561
563 _hg_cmd_qheader() {
562 _hg_cmd_qheader() {
564 _arguments -s -w : $_hg_global_opts \
563 _arguments -s -w : $_hg_global_opts \
565 ':patch:_hg_qseries'
564 ':patch:_hg_qseries'
566 }
565 }
567
566
568 _hg_cmd_qimport() {
567 _hg_cmd_qimport() {
569 _arguments -s -w : $_hg_global_opts \
568 _arguments -s -w : $_hg_global_opts \
570 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
569 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
571 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
570 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
572 '(--force -f)'{-f,--force}'[overwrite existing files]' \
571 '(--force -f)'{-f,--force}'[overwrite existing files]' \
573 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \
572 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \
574 '*:patch:_files'
573 '*:patch:_files'
575 }
574 }
576
575
577 _hg_cmd_qnew() {
576 _hg_cmd_qnew() {
578 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
577 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
579 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
578 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
580 ':patch:'
579 ':patch:'
581 }
580 }
582
581
583 _hg_cmd_qnext() {
582 _hg_cmd_qnext() {
584 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
583 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
585 }
584 }
586
585
587 _hg_cmd_qpop() {
586 _hg_cmd_qpop() {
588 _arguments -s -w : $_hg_global_opts \
587 _arguments -s -w : $_hg_global_opts \
589 '(--all -a :)'{-a,--all}'[pop all patches]' \
588 '(--all -a :)'{-a,--all}'[pop all patches]' \
590 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
589 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
591 '(--force -f)'{-f,--force}'[forget any local changes]' \
590 '(--force -f)'{-f,--force}'[forget any local changes]' \
592 ':patch:_hg_qapplied'
591 ':patch:_hg_qapplied'
593 }
592 }
594
593
595 _hg_cmd_qprev() {
594 _hg_cmd_qprev() {
596 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
595 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
597 }
596 }
598
597
599 _hg_cmd_qpush() {
598 _hg_cmd_qpush() {
600 _arguments -s -w : $_hg_global_opts \
599 _arguments -s -w : $_hg_global_opts \
601 '(--all -a :)'{-a,--all}'[apply all patches]' \
600 '(--all -a :)'{-a,--all}'[apply all patches]' \
602 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
601 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
603 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
602 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
604 '(--name -n)'{-n+,--name}'[merge queue name]:' \
603 '(--name -n)'{-n+,--name}'[merge queue name]:' \
605 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
604 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
606 ':patch:_hg_qunapplied'
605 ':patch:_hg_qunapplied'
607 }
606 }
608
607
609 _hg_cmd_qrefresh() {
608 _hg_cmd_qrefresh() {
610 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
609 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
611 '(--git -g)'{-g,--git}'[use git extended diff format]' \
610 '(--git -g)'{-g,--git}'[use git extended diff format]' \
612 '(--short -s)'{-s,--short}'[short refresh]' \
611 '(--short -s)'{-s,--short}'[short refresh]' \
613 '*:files:_files -W $(_hg_cmd root)'
612 '*:files:_files -W $(_hg_cmd root)'
614 }
613 }
615
614
616 _hg_cmd_qrename() {
615 _hg_cmd_qrename() {
617 _arguments -s -w : $_hg_global_opts \
616 _arguments -s -w : $_hg_global_opts \
618 ':patch:_hg_qseries' \
617 ':patch:_hg_qseries' \
619 ':destination:'
618 ':destination:'
620 }
619 }
621
620
622 _hg_cmd_qselect() {
621 _hg_cmd_qselect() {
623 _arguments -s -w : $_hg_global_opts \
622 _arguments -s -w : $_hg_global_opts \
624 '(--none -n :)'{-n,--none}'[disable all guards]' \
623 '(--none -n :)'{-n,--none}'[disable all guards]' \
625 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
624 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
626 '--pop[pop to before first guarded applied patch]' \
625 '--pop[pop to before first guarded applied patch]' \
627 '--reapply[pop and reapply patches]' \
626 '--reapply[pop and reapply patches]' \
628 '*:guards:_hg_qguards'
627 '*:guards:_hg_qguards'
629 }
628 }
630
629
631 _hg_cmd_qseries() {
630 _hg_cmd_qseries() {
632 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
631 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
633 '(--missing -m)'{-m,--missing}'[print patches not in series]'
632 '(--missing -m)'{-m,--missing}'[print patches not in series]'
634 }
633 }
635
634
636 _hg_cmd_qunapplied() {
635 _hg_cmd_qunapplied() {
637 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
636 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
638 }
637 }
639
638
640 _hg_cmd_qtop() {
639 _hg_cmd_qtop() {
641 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
640 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
642 }
641 }
643
642
644 _hg_cmd_strip() {
643 _hg_cmd_strip() {
645 _arguments -s -w : $_hg_global_opts \
644 _arguments -s -w : $_hg_global_opts \
646 '(--force -f)'{-f,--force}'[force multi-head removal]' \
645 '(--force -f)'{-f,--force}'[force multi-head removal]' \
647 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
646 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
648 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
647 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
649 ':revision:_hg_tags'
648 ':revision:_hg_tags'
650 }
649 }
651
650
652 _hg "$@"
651 _hg "$@"
General Comments 0
You need to be logged in to leave comments. Login now