##// END OF EJS Templates
zsh_completion: fix issue with overlong branch/tag names
Johannes Schlatow -
r18419:45bb5df4 default
parent child Browse files
Show More
@@ -1,1227 +1,1226 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 # If you do not want to install it globally, you can copy it somewhere
7 # If you do not want to install it globally, you can copy it somewhere
8 # else and add that directory to $fpath. This must be done before
8 # else and add that directory to $fpath. This must be done before
9 # compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
9 # compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
10 # file could look like this:
10 # file could look like this:
11 #
11 #
12 # fpath=("$HOME/.zsh.d" $fpath)
12 # fpath=("$HOME/.zsh.d" $fpath)
13 # autoload -U compinit
13 # autoload -U compinit
14 # compinit
14 # compinit
15 #
15 #
16 # Copyright (C) 2005, 2006 Steve Borho <steve@borho.org>
16 # Copyright (C) 2005, 2006 Steve Borho <steve@borho.org>
17 # Copyright (C) 2006-10 Brendan Cully <brendan@kublai.com>
17 # Copyright (C) 2006-10 Brendan Cully <brendan@kublai.com>
18 #
18 #
19 # Permission is hereby granted, without written agreement and without
19 # Permission is hereby granted, without written agreement and without
20 # licence or royalty fees, to use, copy, modify, and distribute this
20 # licence or royalty fees, to use, copy, modify, and distribute this
21 # software and to distribute modified versions of this software for any
21 # software and to distribute modified versions of this software for any
22 # purpose, provided that the above copyright notice and the following
22 # purpose, provided that the above copyright notice and the following
23 # two paragraphs appear in all copies of this software.
23 # two paragraphs appear in all copies of this software.
24 #
24 #
25 # In no event shall the authors be liable to any party for direct,
25 # In no event shall the authors be liable to any party for direct,
26 # indirect, special, incidental, or consequential damages arising out of
26 # indirect, special, incidental, or consequential damages arising out of
27 # the use of this software and its documentation, even if the authors
27 # the use of this software and its documentation, even if the authors
28 # have been advised of the possibility of such damage.
28 # have been advised of the possibility of such damage.
29 #
29 #
30 # The authors specifically disclaim any warranties, including, but not
30 # The authors specifically disclaim any warranties, including, but not
31 # limited to, the implied warranties of merchantability and fitness for
31 # limited to, the implied warranties of merchantability and fitness for
32 # a particular purpose. The software provided hereunder is on an "as
32 # a particular purpose. The software provided hereunder is on an "as
33 # is" basis, and the authors have no obligation to provide maintenance,
33 # is" basis, and the authors have no obligation to provide maintenance,
34 # support, updates, enhancements, or modifications.
34 # support, updates, enhancements, or modifications.
35
35
36 emulate -LR zsh
36 emulate -LR zsh
37 setopt extendedglob
37 setopt extendedglob
38
38
39 local curcontext="$curcontext" state line
39 local curcontext="$curcontext" state line
40 typeset -A _hg_cmd_globals
40 typeset -A _hg_cmd_globals
41
41
42 _hg() {
42 _hg() {
43 local cmd _hg_root
43 local cmd _hg_root
44 integer i=2
44 integer i=2
45 _hg_cmd_globals=()
45 _hg_cmd_globals=()
46
46
47 while (( i < $#words ))
47 while (( i < $#words ))
48 do
48 do
49 case "$words[$i]" in
49 case "$words[$i]" in
50 -R|--repository)
50 -R|--repository)
51 eval _hg_root="$words[$i+1]"
51 eval _hg_root="$words[$i+1]"
52 _hg_cmd_globals+=("$words[$i]" "$_hg_root")
52 _hg_cmd_globals+=("$words[$i]" "$_hg_root")
53 (( i += 2 ))
53 (( i += 2 ))
54 continue
54 continue
55 ;;
55 ;;
56 -R*)
56 -R*)
57 _hg_cmd_globals+="$words[$i]"
57 _hg_cmd_globals+="$words[$i]"
58 eval _hg_root="${words[$i]#-R}"
58 eval _hg_root="${words[$i]#-R}"
59 (( i++ ))
59 (( i++ ))
60 continue
60 continue
61 ;;
61 ;;
62 --cwd|--config)
62 --cwd|--config)
63 # pass along arguments to hg completer
63 # pass along arguments to hg completer
64 _hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
64 _hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
65 (( i += 2 ))
65 (( i += 2 ))
66 continue
66 continue
67 ;;
67 ;;
68 -*)
68 -*)
69 # skip option
69 # skip option
70 (( i++ ))
70 (( i++ ))
71 continue
71 continue
72 ;;
72 ;;
73 esac
73 esac
74 if [[ -z "$cmd" ]]
74 if [[ -z "$cmd" ]]
75 then
75 then
76 cmd="$words[$i]"
76 cmd="$words[$i]"
77 words[$i]=()
77 words[$i]=()
78 (( CURRENT-- ))
78 (( CURRENT-- ))
79 fi
79 fi
80 (( i++ ))
80 (( i++ ))
81 done
81 done
82
82
83 if [[ -z "$cmd" ]]
83 if [[ -z "$cmd" ]]
84 then
84 then
85 _arguments -s -w : $_hg_global_opts \
85 _arguments -s -w : $_hg_global_opts \
86 ':mercurial command:_hg_commands'
86 ':mercurial command:_hg_commands'
87 return
87 return
88 fi
88 fi
89
89
90 # resolve abbreviations and aliases
90 # resolve abbreviations and aliases
91 if ! (( $+functions[_hg_cmd_${cmd}] ))
91 if ! (( $+functions[_hg_cmd_${cmd}] ))
92 then
92 then
93 local cmdexp
93 local cmdexp
94 (( $#_hg_cmd_list )) || _hg_get_commands
94 (( $#_hg_cmd_list )) || _hg_get_commands
95
95
96 cmdexp=$_hg_cmd_list[(r)${cmd}*]
96 cmdexp=$_hg_cmd_list[(r)${cmd}*]
97 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
97 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
98 then
98 then
99 # might be nice to rewrite the command line with the expansion
99 # might be nice to rewrite the command line with the expansion
100 cmd="$cmdexp"
100 cmd="$cmdexp"
101 fi
101 fi
102 if [[ -n $_hg_alias_list[$cmd] ]]
102 if [[ -n $_hg_alias_list[$cmd] ]]
103 then
103 then
104 cmd=$_hg_alias_list[$cmd]
104 cmd=$_hg_alias_list[$cmd]
105 fi
105 fi
106 fi
106 fi
107
107
108 curcontext="${curcontext%:*:*}:hg-${cmd}:"
108 curcontext="${curcontext%:*:*}:hg-${cmd}:"
109
109
110 zstyle -s ":completion:$curcontext:" cache-policy update_policy
110 zstyle -s ":completion:$curcontext:" cache-policy update_policy
111
111
112 if [[ -z "$update_policy" ]]
112 if [[ -z "$update_policy" ]]
113 then
113 then
114 zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
114 zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
115 fi
115 fi
116
116
117 if (( $+functions[_hg_cmd_${cmd}] ))
117 if (( $+functions[_hg_cmd_${cmd}] ))
118 then
118 then
119 _hg_cmd_${cmd}
119 _hg_cmd_${cmd}
120 else
120 else
121 # complete unknown commands normally
121 # complete unknown commands normally
122 _arguments -s -w : $_hg_global_opts \
122 _arguments -s -w : $_hg_global_opts \
123 '*:files:_hg_files'
123 '*:files:_hg_files'
124 fi
124 fi
125 }
125 }
126
126
127 _hg_cache_policy() {
127 _hg_cache_policy() {
128 typeset -a old
128 typeset -a old
129
129
130 # cache for a minute
130 # cache for a minute
131 old=( "$1"(mm+10) )
131 old=( "$1"(mm+10) )
132 (( $#old )) && return 0
132 (( $#old )) && return 0
133
133
134 return 1
134 return 1
135 }
135 }
136
136
137 _hg_get_commands() {
137 _hg_get_commands() {
138 typeset -ga _hg_cmd_list
138 typeset -ga _hg_cmd_list
139 typeset -gA _hg_alias_list
139 typeset -gA _hg_alias_list
140 local hline cmd cmdalias
140 local hline cmd cmdalias
141
141
142 _call_program hg hg debugcomplete -v | while read -A hline
142 _call_program hg hg debugcomplete -v | while read -A hline
143 do
143 do
144 cmd=$hline[1]
144 cmd=$hline[1]
145 _hg_cmd_list+=($cmd)
145 _hg_cmd_list+=($cmd)
146
146
147 for cmdalias in $hline[2,-1]
147 for cmdalias in $hline[2,-1]
148 do
148 do
149 _hg_cmd_list+=($cmdalias)
149 _hg_cmd_list+=($cmdalias)
150 _hg_alias_list+=($cmdalias $cmd)
150 _hg_alias_list+=($cmdalias $cmd)
151 done
151 done
152 done
152 done
153 }
153 }
154
154
155 _hg_commands() {
155 _hg_commands() {
156 (( $#_hg_cmd_list )) || _hg_get_commands
156 (( $#_hg_cmd_list )) || _hg_get_commands
157 _describe -t commands 'mercurial command' _hg_cmd_list
157 _describe -t commands 'mercurial command' _hg_cmd_list
158 }
158 }
159
159
160 _hg_revrange() {
160 _hg_revrange() {
161 compset -P 1 '*:'
161 compset -P 1 '*:'
162 _hg_labels "$@"
162 _hg_labels "$@"
163 }
163 }
164
164
165 _hg_labels() {
165 _hg_labels() {
166 _hg_tags "$@"
166 _hg_tags "$@"
167 _hg_bookmarks "$@"
167 _hg_bookmarks "$@"
168 _hg_branches "$@"
168 _hg_branches "$@"
169 }
169 }
170
170
171 _hg_tags() {
171 _hg_tags() {
172 typeset -a tags
172 typeset -a tags
173 local tag rev
173 local tag rev
174
174
175 _hg_cmd tags | while read tag
175 _hg_cmd tags | while read tag
176 do
176 do
177 tags+=(${tag/ # [0-9]#:*})
177 tags+=(${tag/ #[0-9]#:*})
178 done
178 done
179 (( $#tags )) && _describe -t tags 'tags' tags
179 (( $#tags )) && _describe -t tags 'tags' tags
180 }
180 }
181
182 _hg_bookmarks() {
181 _hg_bookmarks() {
183 typeset -a bookmark bookmarks
182 typeset -a bookmark bookmarks
184
183
185 _hg_cmd bookmarks | while read -A bookmark
184 _hg_cmd bookmarks | while read -A bookmark
186 do
185 do
187 if test -z ${bookmark[-1]:#[0-9]*}
186 if test -z ${bookmark[-1]:#[0-9]*}
188 then
187 then
189 bookmarks+=($bookmark[-2])
188 bookmarks+=($bookmark[-2])
190 fi
189 fi
191 done
190 done
192 (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
191 (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
193 }
192 }
194
193
195 _hg_branches() {
194 _hg_branches() {
196 typeset -a branches
195 typeset -a branches
197 local branch
196 local branch
198
197
199 _hg_cmd branches | while read branch
198 _hg_cmd branches | while read branch
200 do
199 do
201 branches+=(${branch/ # [0-9]#:*})
200 branches+=(${branch/ #[0-9]#:*})
202 done
201 done
203 (( $#branches )) && _describe -t branches 'branches' branches
202 (( $#branches )) && _describe -t branches 'branches' branches
204 }
203 }
205
204
206 # likely merge candidates
205 # likely merge candidates
207 _hg_mergerevs() {
206 _hg_mergerevs() {
208 typeset -a heads
207 typeset -a heads
209 local myrev
208 local myrev
210
209
211 heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"})
210 heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"})
212 # exclude own revision
211 # exclude own revision
213 myrev=$(_hg_cmd log -r . --template '{rev}\\n')
212 myrev=$(_hg_cmd log -r . --template '{rev}\\n')
214 heads=(${heads:#$myrev})
213 heads=(${heads:#$myrev})
215
214
216 (( $#heads )) && _describe -t heads 'heads' heads
215 (( $#heads )) && _describe -t heads 'heads' heads
217 }
216 }
218
217
219 _hg_files() {
218 _hg_files() {
220 if [[ -n "$_hg_root" ]]
219 if [[ -n "$_hg_root" ]]
221 then
220 then
222 [[ -d "$_hg_root/.hg" ]] || return
221 [[ -d "$_hg_root/.hg" ]] || return
223 case "$_hg_root" in
222 case "$_hg_root" in
224 /*)
223 /*)
225 _files -W $_hg_root
224 _files -W $_hg_root
226 ;;
225 ;;
227 *)
226 *)
228 _files -W $PWD/$_hg_root
227 _files -W $PWD/$_hg_root
229 ;;
228 ;;
230 esac
229 esac
231 else
230 else
232 _files
231 _files
233 fi
232 fi
234 }
233 }
235
234
236 _hg_status() {
235 _hg_status() {
237 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
236 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
238 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
237 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
239 }
238 }
240
239
241 _hg_unknown() {
240 _hg_unknown() {
242 typeset -a status_files
241 typeset -a status_files
243 _hg_status u
242 _hg_status u
244 _wanted files expl 'unknown files' _multi_parts / status_files
243 _wanted files expl 'unknown files' _multi_parts / status_files
245 }
244 }
246
245
247 _hg_missing() {
246 _hg_missing() {
248 typeset -a status_files
247 typeset -a status_files
249 _hg_status d
248 _hg_status d
250 _wanted files expl 'missing files' _multi_parts / status_files
249 _wanted files expl 'missing files' _multi_parts / status_files
251 }
250 }
252
251
253 _hg_modified() {
252 _hg_modified() {
254 typeset -a status_files
253 typeset -a status_files
255 _hg_status m
254 _hg_status m
256 _wanted files expl 'modified files' _multi_parts / status_files
255 _wanted files expl 'modified files' _multi_parts / status_files
257 }
256 }
258
257
259 _hg_resolve() {
258 _hg_resolve() {
260 local rstate rpath
259 local rstate rpath
261
260
262 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
261 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
263
262
264 _hg_cmd resolve -l ./$PREFIX | while read rstate rpath
263 _hg_cmd resolve -l ./$PREFIX | while read rstate rpath
265 do
264 do
266 [[ $rstate == 'R' ]] && resolved_files+=($rpath)
265 [[ $rstate == 'R' ]] && resolved_files+=($rpath)
267 [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
266 [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
268 done
267 done
269 }
268 }
270
269
271 _hg_resolved() {
270 _hg_resolved() {
272 typeset -a resolved_files unresolved_files
271 typeset -a resolved_files unresolved_files
273 _hg_resolve
272 _hg_resolve
274 _wanted files expl 'resolved files' _multi_parts / resolved_files
273 _wanted files expl 'resolved files' _multi_parts / resolved_files
275 }
274 }
276
275
277 _hg_unresolved() {
276 _hg_unresolved() {
278 typeset -a resolved_files unresolved_files
277 typeset -a resolved_files unresolved_files
279 _hg_resolve
278 _hg_resolve
280 _wanted files expl 'unresolved files' _multi_parts / unresolved_files
279 _wanted files expl 'unresolved files' _multi_parts / unresolved_files
281 }
280 }
282
281
283 _hg_config() {
282 _hg_config() {
284 typeset -a items
283 typeset -a items
285 items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
284 items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
286 (( $#items )) && _describe -t config 'config item' items
285 (( $#items )) && _describe -t config 'config item' items
287 }
286 }
288
287
289 _hg_addremove() {
288 _hg_addremove() {
290 _alternative 'files:unknown files:_hg_unknown' \
289 _alternative 'files:unknown files:_hg_unknown' \
291 'files:missing files:_hg_missing'
290 'files:missing files:_hg_missing'
292 }
291 }
293
292
294 _hg_ssh_urls() {
293 _hg_ssh_urls() {
295 if [[ -prefix */ ]]
294 if [[ -prefix */ ]]
296 then
295 then
297 if zstyle -T ":completion:${curcontext}:files" remote-access
296 if zstyle -T ":completion:${curcontext}:files" remote-access
298 then
297 then
299 local host=${PREFIX%%/*}
298 local host=${PREFIX%%/*}
300 typeset -a remdirs
299 typeset -a remdirs
301 compset -p $(( $#host + 1 ))
300 compset -p $(( $#host + 1 ))
302 local rempath=${(M)PREFIX##*/}
301 local rempath=${(M)PREFIX##*/}
303 local cacheid="hg:${host}-${rempath//\//_}"
302 local cacheid="hg:${host}-${rempath//\//_}"
304 cacheid=${cacheid%[-_]}
303 cacheid=${cacheid%[-_]}
305 compset -P '*/'
304 compset -P '*/'
306 if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
305 if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
307 then
306 then
308 remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
307 remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
309 _store_cache "$cacheid" remdirs
308 _store_cache "$cacheid" remdirs
310 fi
309 fi
311 _describe -t directories 'remote directory' remdirs -S/
310 _describe -t directories 'remote directory' remdirs -S/
312 else
311 else
313 _message 'remote directory'
312 _message 'remote directory'
314 fi
313 fi
315 else
314 else
316 if compset -P '*@'
315 if compset -P '*@'
317 then
316 then
318 _hosts -S/
317 _hosts -S/
319 else
318 else
320 _alternative 'hosts:remote host name:_hosts -S/' \
319 _alternative 'hosts:remote host name:_hosts -S/' \
321 'users:user:_users -S@'
320 'users:user:_users -S@'
322 fi
321 fi
323 fi
322 fi
324 }
323 }
325
324
326 _hg_urls() {
325 _hg_urls() {
327 if compset -P bundle://
326 if compset -P bundle://
328 then
327 then
329 _files
328 _files
330 elif compset -P ssh://
329 elif compset -P ssh://
331 then
330 then
332 _hg_ssh_urls
331 _hg_ssh_urls
333 elif [[ -prefix *: ]]
332 elif [[ -prefix *: ]]
334 then
333 then
335 _urls
334 _urls
336 else
335 else
337 local expl
336 local expl
338 compset -S '[^:]*'
337 compset -S '[^:]*'
339 _wanted url-schemas expl 'URL schema' compadd -S '' - \
338 _wanted url-schemas expl 'URL schema' compadd -S '' - \
340 http:// https:// ssh:// bundle://
339 http:// https:// ssh:// bundle://
341 fi
340 fi
342 }
341 }
343
342
344 _hg_paths() {
343 _hg_paths() {
345 typeset -a paths pnames
344 typeset -a paths pnames
346 _hg_cmd paths | while read -A pnames
345 _hg_cmd paths | while read -A pnames
347 do
346 do
348 paths+=($pnames[1])
347 paths+=($pnames[1])
349 done
348 done
350 (( $#paths )) && _describe -t path-aliases 'repository alias' paths
349 (( $#paths )) && _describe -t path-aliases 'repository alias' paths
351 }
350 }
352
351
353 _hg_remote() {
352 _hg_remote() {
354 _alternative 'path-aliases:repository alias:_hg_paths' \
353 _alternative 'path-aliases:repository alias:_hg_paths' \
355 'directories:directory:_files -/' \
354 'directories:directory:_files -/' \
356 'urls:URL:_hg_urls'
355 'urls:URL:_hg_urls'
357 }
356 }
358
357
359 _hg_clone_dest() {
358 _hg_clone_dest() {
360 _alternative 'directories:directory:_files -/' \
359 _alternative 'directories:directory:_files -/' \
361 'urls:URL:_hg_urls'
360 'urls:URL:_hg_urls'
362 }
361 }
363
362
364 _hg_add_help_topics=(
363 _hg_add_help_topics=(
365 config dates diffs environment extensions filesets glossary hgignore hgweb
364 config dates diffs environment extensions filesets glossary hgignore hgweb
366 merge-tools multirevs obsolescence patterns phases revisions revsets
365 merge-tools multirevs obsolescence patterns phases revisions revsets
367 subrepos templating urls
366 subrepos templating urls
368 )
367 )
369
368
370 _hg_help_topics() {
369 _hg_help_topics() {
371 local topics
370 local topics
372 (( $#_hg_cmd_list )) || _hg_get_commands
371 (( $#_hg_cmd_list )) || _hg_get_commands
373 topics=($_hg_cmd_list $_hg_add_help_topics)
372 topics=($_hg_cmd_list $_hg_add_help_topics)
374 _describe -t help_topics 'help topics' topics
373 _describe -t help_topics 'help topics' topics
375 }
374 }
376
375
377 # Common options
376 # Common options
378 _hg_global_opts=(
377 _hg_global_opts=(
379 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
378 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
380 '--cwd[change working directory]:new working directory:_files -/'
379 '--cwd[change working directory]:new working directory:_files -/'
381 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
380 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
382 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
381 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
383 '*--config[set/override config option]:defined config items:_hg_config'
382 '*--config[set/override config option]:defined config items:_hg_config'
384 '(--quiet -q)'{-q,--quiet}'[suppress output]'
383 '(--quiet -q)'{-q,--quiet}'[suppress output]'
385 '(--help -h)'{-h,--help}'[display help and exit]'
384 '(--help -h)'{-h,--help}'[display help and exit]'
386 '--debug[debug mode]'
385 '--debug[debug mode]'
387 '--debugger[start debugger]'
386 '--debugger[start debugger]'
388 '--encoding[set the charset encoding]'
387 '--encoding[set the charset encoding]'
389 '--encodingmode[set the charset encoding mode]'
388 '--encodingmode[set the charset encoding mode]'
390 '--lsprof[print improved command execution profile]'
389 '--lsprof[print improved command execution profile]'
391 '--traceback[print traceback on exception]'
390 '--traceback[print traceback on exception]'
392 '--time[time how long the command takes]'
391 '--time[time how long the command takes]'
393 '--profile[profile]'
392 '--profile[profile]'
394 '--version[output version information and exit]'
393 '--version[output version information and exit]'
395 )
394 )
396
395
397 _hg_pat_opts=(
396 _hg_pat_opts=(
398 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
397 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
399 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
398 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
400
399
401 _hg_clone_opts=(
400 _hg_clone_opts=(
402 $_hg_remote_opts
401 $_hg_remote_opts
403 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]'
402 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]'
404 '--pull[use pull protocol to copy metadata]'
403 '--pull[use pull protocol to copy metadata]'
405 '--uncompressed[use uncompressed transfer (fast over LAN)]')
404 '--uncompressed[use uncompressed transfer (fast over LAN)]')
406
405
407 _hg_date_user_opts=(
406 _hg_date_user_opts=(
408 '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]'
407 '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]'
409 '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]'
408 '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]'
410 '(--date -d)'{-d+,--date}'[record the specified date as commit date]:date:'
409 '(--date -d)'{-d+,--date}'[record the specified date as commit date]:date:'
411 '(--user -u)'{-u+,--user}'[record the specified user as committer]:user:')
410 '(--user -u)'{-u+,--user}'[record the specified user as committer]:user:')
412
411
413 _hg_gitlike_opts=(
412 _hg_gitlike_opts=(
414 '(--git -g)'{-g,--git}'[use git extended diff format]')
413 '(--git -g)'{-g,--git}'[use git extended diff format]')
415
414
416 _hg_diff_opts=(
415 _hg_diff_opts=(
417 $_hg_gitlike_opts
416 $_hg_gitlike_opts
418 '(--text -a)'{-a,--text}'[treat all files as text]'
417 '(--text -a)'{-a,--text}'[treat all files as text]'
419 '--nodates[omit dates from diff headers]')
418 '--nodates[omit dates from diff headers]')
420
419
421 _hg_mergetool_opts=(
420 _hg_mergetool_opts=(
422 '(--tool -t)'{-t+,--tool}'[specify merge tool]:tool:')
421 '(--tool -t)'{-t+,--tool}'[specify merge tool]:tool:')
423
422
424 _hg_dryrun_opts=(
423 _hg_dryrun_opts=(
425 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
424 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
426
425
427 _hg_ignore_space_opts=(
426 _hg_ignore_space_opts=(
428 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
427 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
429 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]'
428 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]'
430 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]')
429 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]')
431
430
432 _hg_style_opts=(
431 _hg_style_opts=(
433 '--style[display using template map file]:'
432 '--style[display using template map file]:'
434 '--template[display with template]:')
433 '--template[display with template]:')
435
434
436 _hg_log_opts=(
435 _hg_log_opts=(
437 $_hg_global_opts $_hg_style_opts $_hg_gitlike_opts
436 $_hg_global_opts $_hg_style_opts $_hg_gitlike_opts
438 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:'
437 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:'
439 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]'
438 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]'
440 '(--patch -p)'{-p,--patch}'[show patch]'
439 '(--patch -p)'{-p,--patch}'[show patch]'
441 '--stat[output diffstat-style summary of changes]'
440 '--stat[output diffstat-style summary of changes]'
442 )
441 )
443
442
444 _hg_commit_opts=(
443 _hg_commit_opts=(
445 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
444 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
446 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
445 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
447 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
446 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
448
447
449 _hg_remote_opts=(
448 _hg_remote_opts=(
450 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
449 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
451 '--remotecmd[specify hg command to run on the remote side]:')
450 '--remotecmd[specify hg command to run on the remote side]:')
452
451
453 _hg_branch_bmark_opts=(
452 _hg_branch_bmark_opts=(
454 '(--bookmark -B)'{-B+,--bookmark}'[specify bookmark(s)]:bookmark:_hg_bookmarks'
453 '(--bookmark -B)'{-B+,--bookmark}'[specify bookmark(s)]:bookmark:_hg_bookmarks'
455 '(--branch -b)'{-b+,--branch}'[specify branch(es)]:branch:_hg_branches'
454 '(--branch -b)'{-b+,--branch}'[specify branch(es)]:branch:_hg_branches'
456 )
455 )
457
456
458 _hg_subrepos_opts=(
457 _hg_subrepos_opts=(
459 '(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]')
458 '(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]')
460
459
461 _hg_cmd() {
460 _hg_cmd() {
462 _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
461 _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
463 }
462 }
464
463
465 _hg_cmd_add() {
464 _hg_cmd_add() {
466 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
465 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
467 '*:unknown files:_hg_unknown'
466 '*:unknown files:_hg_unknown'
468 }
467 }
469
468
470 _hg_cmd_addremove() {
469 _hg_cmd_addremove() {
471 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
470 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
472 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
471 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
473 '*:unknown or missing files:_hg_addremove'
472 '*:unknown or missing files:_hg_addremove'
474 }
473 }
475
474
476 _hg_cmd_annotate() {
475 _hg_cmd_annotate() {
477 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
476 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
478 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \
477 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \
479 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
478 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
480 '(--text -a)'{-a,--text}'[treat all files as text]' \
479 '(--text -a)'{-a,--text}'[treat all files as text]' \
481 '(--user -u)'{-u,--user}'[list the author]' \
480 '(--user -u)'{-u,--user}'[list the author]' \
482 '(--date -d)'{-d,--date}'[list the date]' \
481 '(--date -d)'{-d,--date}'[list the date]' \
483 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
482 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
484 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
483 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
485 '*:files:_hg_files'
484 '*:files:_hg_files'
486 }
485 }
487
486
488 _hg_cmd_archive() {
487 _hg_cmd_archive() {
489 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
488 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
490 '--no-decode[do not pass files through decoders]' \
489 '--no-decode[do not pass files through decoders]' \
491 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
490 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
492 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \
491 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \
493 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
492 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
494 '*:destination:_files'
493 '*:destination:_files'
495 }
494 }
496
495
497 _hg_cmd_backout() {
496 _hg_cmd_backout() {
498 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
497 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
499 '--merge[merge with old dirstate parent after backout]' \
498 '--merge[merge with old dirstate parent after backout]' \
500 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
499 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
501 '--parent[parent to choose when backing out merge]' \
500 '--parent[parent to choose when backing out merge]' \
502 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
501 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
503 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
502 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
504 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
503 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
505 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
504 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
506 }
505 }
507
506
508 _hg_cmd_bisect() {
507 _hg_cmd_bisect() {
509 _arguments -s -w : $_hg_global_opts \
508 _arguments -s -w : $_hg_global_opts \
510 '(-)'{-r,--reset}'[reset bisect state]' \
509 '(-)'{-r,--reset}'[reset bisect state]' \
511 '(--extend -e)'{-e,--extend}'[extend the bisect range]' \
510 '(--extend -e)'{-e,--extend}'[extend the bisect range]' \
512 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
511 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
513 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
512 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
514 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
513 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
515 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
514 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
516 '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
515 '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
517 }
516 }
518
517
519 _hg_cmd_bookmarks() {
518 _hg_cmd_bookmarks() {
520 _arguments -s -w : $_hg_global_opts \
519 _arguments -s -w : $_hg_global_opts \
521 '(--force -f)'{-f,--force}'[force]' \
520 '(--force -f)'{-f,--force}'[force]' \
522 '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \
521 '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \
523 '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \
522 '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \
524 '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
523 '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
525 '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
524 '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
526 ':bookmark:_hg_bookmarks'
525 ':bookmark:_hg_bookmarks'
527 }
526 }
528
527
529 _hg_cmd_branch() {
528 _hg_cmd_branch() {
530 _arguments -s -w : $_hg_global_opts \
529 _arguments -s -w : $_hg_global_opts \
531 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
530 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
532 '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
531 '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
533 }
532 }
534
533
535 _hg_cmd_branches() {
534 _hg_cmd_branches() {
536 _arguments -s -w : $_hg_global_opts \
535 _arguments -s -w : $_hg_global_opts \
537 '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]' \
536 '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]' \
538 '(--closed -c)'{-c,--closed}'[show normal and closed branches]'
537 '(--closed -c)'{-c,--closed}'[show normal and closed branches]'
539 }
538 }
540
539
541 _hg_cmd_bundle() {
540 _hg_cmd_bundle() {
542 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
541 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
543 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
542 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
544 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \
543 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \
545 '(--branch -b)'{-b+,--branch}'[a specific branch to bundle]' \
544 '(--branch -b)'{-b+,--branch}'[a specific branch to bundle]' \
546 '(--rev -r)'{-r+,--rev}'[changeset(s) to bundle]:' \
545 '(--rev -r)'{-r+,--rev}'[changeset(s) to bundle]:' \
547 '--all[bundle all changesets in the repository]' \
546 '--all[bundle all changesets in the repository]' \
548 ':output file:_files' \
547 ':output file:_files' \
549 ':destination repository:_files -/'
548 ':destination repository:_files -/'
550 }
549 }
551
550
552 _hg_cmd_cat() {
551 _hg_cmd_cat() {
553 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
552 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
554 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
553 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
555 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
554 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
556 '--decode[apply any matching decode filter]' \
555 '--decode[apply any matching decode filter]' \
557 '*:file:_hg_files'
556 '*:file:_hg_files'
558 }
557 }
559
558
560 _hg_cmd_clone() {
559 _hg_cmd_clone() {
561 _arguments -s -w : $_hg_global_opts $_hg_clone_opts \
560 _arguments -s -w : $_hg_global_opts $_hg_clone_opts \
562 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
561 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
563 '(--updaterev -u)'{-u+,--updaterev}'[revision, tag or branch to check out]' \
562 '(--updaterev -u)'{-u+,--updaterev}'[revision, tag or branch to check out]' \
564 '(--branch -b)'{-b+,--branch}'[clone only the specified branch]' \
563 '(--branch -b)'{-b+,--branch}'[clone only the specified branch]' \
565 ':source repository:_hg_remote' \
564 ':source repository:_hg_remote' \
566 ':destination:_hg_clone_dest'
565 ':destination:_hg_clone_dest'
567 }
566 }
568
567
569 _hg_cmd_commit() {
568 _hg_cmd_commit() {
570 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
569 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
571 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
570 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
572 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
571 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
573 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
572 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
574 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
573 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
575 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
574 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
576 '--amend[amend the parent of the working dir]' \
575 '--amend[amend the parent of the working dir]' \
577 '--close-branch[mark a branch as closed]' \
576 '--close-branch[mark a branch as closed]' \
578 '*:file:_hg_files'
577 '*:file:_hg_files'
579 }
578 }
580
579
581 _hg_cmd_copy() {
580 _hg_cmd_copy() {
582 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
581 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
583 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
582 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
584 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
583 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
585 '*:file:_hg_files'
584 '*:file:_hg_files'
586 }
585 }
587
586
588 _hg_cmd_diff() {
587 _hg_cmd_diff() {
589 typeset -A opt_args
588 typeset -A opt_args
590 _arguments -s -w : $_hg_global_opts $_hg_diff_opts $_hg_ignore_space_opts \
589 _arguments -s -w : $_hg_global_opts $_hg_diff_opts $_hg_ignore_space_opts \
591 $_hg_pat_opts $_hg_subrepos_opts \
590 $_hg_pat_opts $_hg_subrepos_opts \
592 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
591 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
593 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
592 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
594 '(--change -c)'{-c,--change}'[change made by revision]' \
593 '(--change -c)'{-c,--change}'[change made by revision]' \
595 '(--text -a)'{-a,--text}'[treat all files as text]' \
594 '(--text -a)'{-a,--text}'[treat all files as text]' \
596 '--reverse[produce a diff that undoes the changes]' \
595 '--reverse[produce a diff that undoes the changes]' \
597 '(--unified -U)'{-U,--unified}'[number of lines of context to show]' \
596 '(--unified -U)'{-U,--unified}'[number of lines of context to show]' \
598 '--stat[output diffstat-style summary of changes]' \
597 '--stat[output diffstat-style summary of changes]' \
599 '*:file:->diff_files'
598 '*:file:->diff_files'
600
599
601 if [[ $state == 'diff_files' ]]
600 if [[ $state == 'diff_files' ]]
602 then
601 then
603 if [[ -n $opt_args[-r] ]]
602 if [[ -n $opt_args[-r] ]]
604 then
603 then
605 _hg_files
604 _hg_files
606 else
605 else
607 _hg_modified
606 _hg_modified
608 fi
607 fi
609 fi
608 fi
610 }
609 }
611
610
612 _hg_cmd_export() {
611 _hg_cmd_export() {
613 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
612 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
614 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
613 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
615 '--switch-parent[diff against the second parent]' \
614 '--switch-parent[diff against the second parent]' \
616 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
615 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
617 '*:revision:_hg_labels'
616 '*:revision:_hg_labels'
618 }
617 }
619
618
620 _hg_cmd_forget() {
619 _hg_cmd_forget() {
621 _arguments -s -w : $_hg_global_opts \
620 _arguments -s -w : $_hg_global_opts \
622 '*:file:_hg_files'
621 '*:file:_hg_files'
623 }
622 }
624
623
625 _hg_cmd_graft() {
624 _hg_cmd_graft() {
626 _arguments -s -w : $_hg_global_opts $_hg_dryrun_opts \
625 _arguments -s -w : $_hg_global_opts $_hg_dryrun_opts \
627 $_hg_date_user_opts $_hg_mergetool_opts \
626 $_hg_date_user_opts $_hg_mergetool_opts \
628 '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \
627 '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \
629 '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
628 '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
630 '--log[append graft info to log message]' \
629 '--log[append graft info to log message]' \
631 '*:revision:_hg_labels'
630 '*:revision:_hg_labels'
632 }
631 }
633
632
634 _hg_cmd_grep() {
633 _hg_cmd_grep() {
635 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
634 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
636 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
635 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
637 '--all[print all revisions with matches]' \
636 '--all[print all revisions with matches]' \
638 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
637 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
639 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
638 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
640 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
639 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
641 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
640 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
642 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
641 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
643 '(--user -u)'{-u,--user}'[print user who committed change]' \
642 '(--user -u)'{-u,--user}'[print user who committed change]' \
644 '(--date -d)'{-d,--date}'[print date of a changeset]' \
643 '(--date -d)'{-d,--date}'[print date of a changeset]' \
645 '1:search pattern:' \
644 '1:search pattern:' \
646 '*:files:_hg_files'
645 '*:files:_hg_files'
647 }
646 }
648
647
649 _hg_cmd_heads() {
648 _hg_cmd_heads() {
650 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
649 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
651 '(--topo -t)'{-t,--topo}'[show topological heads only]' \
650 '(--topo -t)'{-t,--topo}'[show topological heads only]' \
652 '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \
651 '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \
653 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels'
652 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels'
654 }
653 }
655
654
656 _hg_cmd_help() {
655 _hg_cmd_help() {
657 _arguments -s -w : $_hg_global_opts \
656 _arguments -s -w : $_hg_global_opts \
658 '(--extension -e)'{-e,--extension}'[show only help for extensions]' \
657 '(--extension -e)'{-e,--extension}'[show only help for extensions]' \
659 '(--command -c)'{-c,--command}'[show only help for commands]' \
658 '(--command -c)'{-c,--command}'[show only help for commands]' \
660 '(--keyword -k)'{-k+,--keyword}'[show topics matching keyword]' \
659 '(--keyword -k)'{-k+,--keyword}'[show topics matching keyword]' \
661 '*:mercurial help topic:_hg_help_topics'
660 '*:mercurial help topic:_hg_help_topics'
662 }
661 }
663
662
664 _hg_cmd_identify() {
663 _hg_cmd_identify() {
665 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
664 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
666 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \
665 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \
667 '(--num -n)'{-n+,--num}'[show local revision number]' \
666 '(--num -n)'{-n+,--num}'[show local revision number]' \
668 '(--id -i)'{-i+,--id}'[show global revision id]' \
667 '(--id -i)'{-i+,--id}'[show global revision id]' \
669 '(--branch -b)'{-b+,--branch}'[show branch]' \
668 '(--branch -b)'{-b+,--branch}'[show branch]' \
670 '(--bookmark -B)'{-B+,--bookmark}'[show bookmarks]' \
669 '(--bookmark -B)'{-B+,--bookmark}'[show bookmarks]' \
671 '(--tags -t)'{-t+,--tags}'[show tags]'
670 '(--tags -t)'{-t+,--tags}'[show tags]'
672 }
671 }
673
672
674 _hg_cmd_import() {
673 _hg_cmd_import() {
675 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
674 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
676 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
675 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
677 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
676 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
678 '--bypass[apply patch without touching the working directory]' \
677 '--bypass[apply patch without touching the working directory]' \
679 '--no-commit[do not commit, just update the working directory]' \
678 '--no-commit[do not commit, just update the working directory]' \
680 '--exact[apply patch to the nodes from which it was generated]' \
679 '--exact[apply patch to the nodes from which it was generated]' \
681 '--import-branch[use any branch information in patch (implied by --exact)]' \
680 '--import-branch[use any branch information in patch (implied by --exact)]' \
682 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
681 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
683 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
682 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
684 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
683 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
685 '*:patch:_files'
684 '*:patch:_files'
686 }
685 }
687
686
688 _hg_cmd_incoming() {
687 _hg_cmd_incoming() {
689 _arguments -s -w : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \
688 _arguments -s -w : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \
690 $_hg_subrepos_opts \
689 $_hg_subrepos_opts \
691 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
690 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
692 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_labels' \
691 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_labels' \
693 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
692 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
694 '--bundle[file to store the bundles into]:bundle file:_files' \
693 '--bundle[file to store the bundles into]:bundle file:_files' \
695 ':source:_hg_remote'
694 ':source:_hg_remote'
696 }
695 }
697
696
698 _hg_cmd_init() {
697 _hg_cmd_init() {
699 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
698 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
700 ':dir:_files -/'
699 ':dir:_files -/'
701 }
700 }
702
701
703 _hg_cmd_locate() {
702 _hg_cmd_locate() {
704 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
703 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
705 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \
704 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \
706 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
705 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
707 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
706 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
708 '*:search pattern:_hg_files'
707 '*:search pattern:_hg_files'
709 }
708 }
710
709
711 _hg_cmd_log() {
710 _hg_cmd_log() {
712 _arguments -s -w : $_hg_log_opts $_hg_pat_opts \
711 _arguments -s -w : $_hg_log_opts $_hg_pat_opts \
713 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
712 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
714 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
713 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
715 '(--copies -C)'{-C,--copies}'[show copied files]' \
714 '(--copies -C)'{-C,--copies}'[show copied files]' \
716 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
715 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
717 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
716 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
718 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
717 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
719 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
718 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
720 '(--graph -G)'{-G+,--graph}'[show the revision DAG]' \
719 '(--graph -G)'{-G+,--graph}'[show the revision DAG]' \
721 '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \
720 '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \
722 '(--user -u)'{-u+,--user}'[revisions committed by user]:user:' \
721 '(--user -u)'{-u+,--user}'[revisions committed by user]:user:' \
723 '(--date -d)'{-d+,--date}'[show revisions matching date spec]:date:' \
722 '(--date -d)'{-d+,--date}'[show revisions matching date spec]:date:' \
724 '*:files:_hg_files'
723 '*:files:_hg_files'
725 }
724 }
726
725
727 _hg_cmd_manifest() {
726 _hg_cmd_manifest() {
728 _arguments -s -w : $_hg_global_opts \
727 _arguments -s -w : $_hg_global_opts \
729 '--all[list files from all revisions]' \
728 '--all[list files from all revisions]' \
730 '(--rev -r)'{-r+,--rev}'[revision to display]:revision:_hg_labels' \
729 '(--rev -r)'{-r+,--rev}'[revision to display]:revision:_hg_labels' \
731 ':revision:_hg_labels'
730 ':revision:_hg_labels'
732 }
731 }
733
732
734 _hg_cmd_merge() {
733 _hg_cmd_merge() {
735 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts \
734 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts \
736 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
735 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
737 '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
736 '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
738 '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
737 '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
739 ':revision:_hg_mergerevs'
738 ':revision:_hg_mergerevs'
740 }
739 }
741
740
742 _hg_cmd_outgoing() {
741 _hg_cmd_outgoing() {
743 _arguments -s -w : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \
742 _arguments -s -w : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \
744 $_hg_subrepos_opts \
743 $_hg_subrepos_opts \
745 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
744 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
746 '*'{-r,--rev}'[a specific revision you would like to push]:revision:_hg_revrange' \
745 '*'{-r,--rev}'[a specific revision you would like to push]:revision:_hg_revrange' \
747 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
746 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
748 ':destination:_hg_remote'
747 ':destination:_hg_remote'
749 }
748 }
750
749
751 _hg_cmd_parents() {
750 _hg_cmd_parents() {
752 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
751 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
753 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \
752 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \
754 ':last modified file:_hg_files'
753 ':last modified file:_hg_files'
755 }
754 }
756
755
757 _hg_cmd_paths() {
756 _hg_cmd_paths() {
758 _arguments -s -w : $_hg_global_opts \
757 _arguments -s -w : $_hg_global_opts \
759 ':path:_hg_paths'
758 ':path:_hg_paths'
760 }
759 }
761
760
762 _hg_cmd_phase() {
761 _hg_cmd_phase() {
763 _arguments -s -w : $_hg_global_opts \
762 _arguments -s -w : $_hg_global_opts \
764 '(--public -p)'{-p,--public}'[set changeset phase to public]' \
763 '(--public -p)'{-p,--public}'[set changeset phase to public]' \
765 '(--draft -d)'{-d,--draft}'[set changeset phase to draft]' \
764 '(--draft -d)'{-d,--draft}'[set changeset phase to draft]' \
766 '(--secret -s)'{-s,--secret}'[set changeset phase to secret]' \
765 '(--secret -s)'{-s,--secret}'[set changeset phase to secret]' \
767 '(--force -f)'{-f,--force}'[allow to move boundary backward]' \
766 '(--force -f)'{-f,--force}'[allow to move boundary backward]' \
768 '(--rev -r)'{-r+,--rev}'[target revision]:revision:_hg_labels' \
767 '(--rev -r)'{-r+,--rev}'[target revision]:revision:_hg_labels' \
769 ':revision:_hg_labels'
768 ':revision:_hg_labels'
770 }
769 }
771
770
772 _hg_cmd_pull() {
771 _hg_cmd_pull() {
773 _arguments -s -w : $_hg_global_opts $_hg_branch_bmark_opts $_hg_remote_opts \
772 _arguments -s -w : $_hg_global_opts $_hg_branch_bmark_opts $_hg_remote_opts \
774 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
773 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
775 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
774 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
776 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
775 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
777 ':source:_hg_remote'
776 ':source:_hg_remote'
778 }
777 }
779
778
780 _hg_cmd_push() {
779 _hg_cmd_push() {
781 _arguments -s -w : $_hg_global_opts $_hg_branch_bmark_opts $_hg_remote_opts \
780 _arguments -s -w : $_hg_global_opts $_hg_branch_bmark_opts $_hg_remote_opts \
782 '(--force -f)'{-f,--force}'[force push]' \
781 '(--force -f)'{-f,--force}'[force push]' \
783 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \
782 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \
784 '--new-branch[allow pushing a new branch]' \
783 '--new-branch[allow pushing a new branch]' \
785 ':destination:_hg_remote'
784 ':destination:_hg_remote'
786 }
785 }
787
786
788 _hg_cmd_remove() {
787 _hg_cmd_remove() {
789 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
788 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
790 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
789 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
791 '(--force -f)'{-f,--force}'[remove file even if modified]' \
790 '(--force -f)'{-f,--force}'[remove file even if modified]' \
792 '*:file:_hg_files'
791 '*:file:_hg_files'
793 }
792 }
794
793
795 _hg_cmd_rename() {
794 _hg_cmd_rename() {
796 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
795 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
797 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
796 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
798 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
797 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
799 '*:file:_hg_files'
798 '*:file:_hg_files'
800 }
799 }
801
800
802 _hg_cmd_resolve() {
801 _hg_cmd_resolve() {
803 local context state line
802 local context state line
804 typeset -A opt_args
803 typeset -A opt_args
805
804
806 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
805 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
807 '(--all -a)'{-a,--all}'[select all unresolved files]' \
806 '(--all -a)'{-a,--all}'[select all unresolved files]' \
808 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
807 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
809 '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
808 '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
810 '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
809 '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
811 '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
810 '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
812 '*:file:_hg_unresolved'
811 '*:file:_hg_unresolved'
813
812
814 if [[ $state == 'resolve_files' ]]
813 if [[ $state == 'resolve_files' ]]
815 then
814 then
816 _alternative 'files:resolved files:_hg_resolved' \
815 _alternative 'files:resolved files:_hg_resolved' \
817 'files:unresolved files:_hg_unresolved'
816 'files:unresolved files:_hg_unresolved'
818 fi
817 fi
819 }
818 }
820
819
821 _hg_cmd_revert() {
820 _hg_cmd_revert() {
822 local context state line
821 local context state line
823 typeset -A opt_args
822 typeset -A opt_args
824
823
825 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
824 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
826 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
825 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
827 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \
826 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \
828 '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \
827 '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \
829 '(--date -d)'{-d+,--date}'[tipmost revision matching date]:date code:' \
828 '(--date -d)'{-d+,--date}'[tipmost revision matching date]:date code:' \
830 '*:file:->diff_files'
829 '*:file:->diff_files'
831
830
832 if [[ $state == 'diff_files' ]]
831 if [[ $state == 'diff_files' ]]
833 then
832 then
834 if [[ -n $opt_args[-r] ]]
833 if [[ -n $opt_args[-r] ]]
835 then
834 then
836 _hg_files
835 _hg_files
837 else
836 else
838 typeset -a status_files
837 typeset -a status_files
839 _hg_status mard
838 _hg_status mard
840 _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
839 _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
841 fi
840 fi
842 fi
841 fi
843 }
842 }
844
843
845 _hg_cmd_rollback() {
844 _hg_cmd_rollback() {
846 _arguments -s -w : $_hg_global_opts $_hg_dryrun_opts \
845 _arguments -s -w : $_hg_global_opts $_hg_dryrun_opts \
847 '(--force -f)'{-f,--force}'[ignore safety measures]' \
846 '(--force -f)'{-f,--force}'[ignore safety measures]' \
848 }
847 }
849
848
850 _hg_cmd_serve() {
849 _hg_cmd_serve() {
851 _arguments -s -w : $_hg_global_opts \
850 _arguments -s -w : $_hg_global_opts \
852 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
851 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
853 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
852 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
854 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
853 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
855 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
854 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
856 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
855 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
857 '--prefix[prefix path to serve from]:directory:_files' \
856 '--prefix[prefix path to serve from]:directory:_files' \
858 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
857 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
859 '--web-conf[name of the hgweb config file]:webconf_file:_files' \
858 '--web-conf[name of the hgweb config file]:webconf_file:_files' \
860 '--pid-file[name of file to write process ID to]:pid_file:_files' \
859 '--pid-file[name of file to write process ID to]:pid_file:_files' \
861 '--cmdserver[cmdserver mode]:mode:' \
860 '--cmdserver[cmdserver mode]:mode:' \
862 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
861 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
863 '--style[web template style]:style' \
862 '--style[web template style]:style' \
864 '--stdio[for remote clients]' \
863 '--stdio[for remote clients]' \
865 '--certificate[certificate file]:cert_file:_files' \
864 '--certificate[certificate file]:cert_file:_files' \
866 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
865 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
867 }
866 }
868
867
869 _hg_cmd_showconfig() {
868 _hg_cmd_showconfig() {
870 _arguments -s -w : $_hg_global_opts \
869 _arguments -s -w : $_hg_global_opts \
871 '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \
870 '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \
872 ':config item:_hg_config'
871 ':config item:_hg_config'
873 }
872 }
874
873
875 _hg_cmd_status() {
874 _hg_cmd_status() {
876 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
875 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
877 '(--all -A)'{-A,--all}'[show status of all files]' \
876 '(--all -A)'{-A,--all}'[show status of all files]' \
878 '(--modified -m)'{-m,--modified}'[show only modified files]' \
877 '(--modified -m)'{-m,--modified}'[show only modified files]' \
879 '(--added -a)'{-a,--added}'[show only added files]' \
878 '(--added -a)'{-a,--added}'[show only added files]' \
880 '(--removed -r)'{-r,--removed}'[show only removed files]' \
879 '(--removed -r)'{-r,--removed}'[show only removed files]' \
881 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
880 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
882 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
881 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
883 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
882 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
884 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
883 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
885 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
884 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
886 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
885 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
887 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
886 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
888 '--rev[show difference from revision]:revision:_hg_labels' \
887 '--rev[show difference from revision]:revision:_hg_labels' \
889 '--change[list the changed files of a revision]:revision:_hg_labels' \
888 '--change[list the changed files of a revision]:revision:_hg_labels' \
890 '*:files:_files'
889 '*:files:_files'
891 }
890 }
892
891
893 _hg_cmd_summary() {
892 _hg_cmd_summary() {
894 _arguments -s -w : $_hg_global_opts \
893 _arguments -s -w : $_hg_global_opts \
895 '--remote[check for push and pull]'
894 '--remote[check for push and pull]'
896 }
895 }
897
896
898 _hg_cmd_tag() {
897 _hg_cmd_tag() {
899 _arguments -s -w : $_hg_global_opts \
898 _arguments -s -w : $_hg_global_opts \
900 '(--local -l)'{-l,--local}'[make the tag local]' \
899 '(--local -l)'{-l,--local}'[make the tag local]' \
901 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
900 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
902 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
901 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
903 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
902 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
904 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \
903 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \
905 '(--force -f)'{-f,--force}'[force tag]' \
904 '(--force -f)'{-f,--force}'[force tag]' \
906 '--remove[remove a tag]' \
905 '--remove[remove a tag]' \
907 '(--edit -e)'{-e,--edit}'[edit commit message]' \
906 '(--edit -e)'{-e,--edit}'[edit commit message]' \
908 ':tag name:'
907 ':tag name:'
909 }
908 }
910
909
911 _hg_cmd_tip() {
910 _hg_cmd_tip() {
912 _arguments -s -w : $_hg_global_opts $_hg_gitlike_opts $_hg_style_opts \
911 _arguments -s -w : $_hg_global_opts $_hg_gitlike_opts $_hg_style_opts \
913 '(--patch -p)'{-p,--patch}'[show patch]'
912 '(--patch -p)'{-p,--patch}'[show patch]'
914 }
913 }
915
914
916 _hg_cmd_unbundle() {
915 _hg_cmd_unbundle() {
917 _arguments -s -w : $_hg_global_opts \
916 _arguments -s -w : $_hg_global_opts \
918 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
917 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
919 ':files:_files'
918 ':files:_files'
920 }
919 }
921
920
922 _hg_cmd_update() {
921 _hg_cmd_update() {
923 _arguments -s -w : $_hg_global_opts \
922 _arguments -s -w : $_hg_global_opts \
924 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
923 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
925 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
924 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
926 '(--check -c)'{-c,--check}'[update across branches if no uncommitted changes]' \
925 '(--check -c)'{-c,--check}'[update across branches if no uncommitted changes]' \
927 '(--date -d)'{-d+,--date}'[tipmost revision matching date]' \
926 '(--date -d)'{-d+,--date}'[tipmost revision matching date]' \
928 ':revision:_hg_labels'
927 ':revision:_hg_labels'
929 }
928 }
930
929
931 ## extensions ##
930 ## extensions ##
932
931
933 # HGK
932 # HGK
934 _hg_cmd_view() {
933 _hg_cmd_view() {
935 _arguments -s -w : $_hg_global_opts \
934 _arguments -s -w : $_hg_global_opts \
936 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
935 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
937 ':revision range:_hg_tags'
936 ':revision range:_hg_tags'
938 }
937 }
939
938
940 # MQ
939 # MQ
941 _hg_qseries() {
940 _hg_qseries() {
942 typeset -a patches
941 typeset -a patches
943 patches=(${(f)"$(_hg_cmd qseries)"})
942 patches=(${(f)"$(_hg_cmd qseries)"})
944 (( $#patches )) && _describe -t hg-patches 'patches' patches
943 (( $#patches )) && _describe -t hg-patches 'patches' patches
945 }
944 }
946
945
947 _hg_qapplied() {
946 _hg_qapplied() {
948 typeset -a patches
947 typeset -a patches
949 patches=(${(f)"$(_hg_cmd qapplied)"})
948 patches=(${(f)"$(_hg_cmd qapplied)"})
950 if (( $#patches ))
949 if (( $#patches ))
951 then
950 then
952 patches+=(qbase qtip)
951 patches+=(qbase qtip)
953 _describe -t hg-applied-patches 'applied patches' patches
952 _describe -t hg-applied-patches 'applied patches' patches
954 fi
953 fi
955 }
954 }
956
955
957 _hg_qunapplied() {
956 _hg_qunapplied() {
958 typeset -a patches
957 typeset -a patches
959 patches=(${(f)"$(_hg_cmd qunapplied)"})
958 patches=(${(f)"$(_hg_cmd qunapplied)"})
960 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
959 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
961 }
960 }
962
961
963 # unapplied, including guarded patches
962 # unapplied, including guarded patches
964 _hg_qdeletable() {
963 _hg_qdeletable() {
965 typeset -a unapplied
964 typeset -a unapplied
966 unapplied=(${(f)"$(_hg_cmd qseries)"})
965 unapplied=(${(f)"$(_hg_cmd qseries)"})
967 for p in $(_hg_cmd qapplied)
966 for p in $(_hg_cmd qapplied)
968 do
967 do
969 unapplied=(${unapplied:#$p})
968 unapplied=(${unapplied:#$p})
970 done
969 done
971
970
972 (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
971 (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
973 }
972 }
974
973
975 _hg_qguards() {
974 _hg_qguards() {
976 typeset -a guards
975 typeset -a guards
977 local guard
976 local guard
978 compset -P "+|-"
977 compset -P "+|-"
979 _hg_cmd qselect -s | while read guard
978 _hg_cmd qselect -s | while read guard
980 do
979 do
981 guards+=(${guard#(+|-)})
980 guards+=(${guard#(+|-)})
982 done
981 done
983 (( $#guards )) && _describe -t hg-guards 'guards' guards
982 (( $#guards )) && _describe -t hg-guards 'guards' guards
984 }
983 }
985
984
986 _hg_qseries_opts=(
985 _hg_qseries_opts=(
987 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
986 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
988
987
989 _hg_cmd_qapplied() {
988 _hg_cmd_qapplied() {
990 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
989 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
991 '(--last -1)'{-1,--last}'[show only the preceding applied patch]' \
990 '(--last -1)'{-1,--last}'[show only the preceding applied patch]' \
992 '*:patch:_hg_qapplied'
991 '*:patch:_hg_qapplied'
993 }
992 }
994
993
995 _hg_cmd_qclone() {
994 _hg_cmd_qclone() {
996 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_clone_opts \
995 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_clone_opts \
997 '(--patches -p)'{-p+,--patches}'[location of source patch repository]' \
996 '(--patches -p)'{-p+,--patches}'[location of source patch repository]' \
998 ':source repository:_hg_remote' \
997 ':source repository:_hg_remote' \
999 ':destination:_hg_clone_dest'
998 ':destination:_hg_clone_dest'
1000 }
999 }
1001
1000
1002 _hg_cmd_qdelete() {
1001 _hg_cmd_qdelete() {
1003 _arguments -s -w : $_hg_global_opts \
1002 _arguments -s -w : $_hg_global_opts \
1004 '(--keep -k)'{-k,--keep}'[keep patch file]' \
1003 '(--keep -k)'{-k,--keep}'[keep patch file]' \
1005 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
1004 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
1006 '*:unapplied patch:_hg_qdeletable'
1005 '*:unapplied patch:_hg_qdeletable'
1007 }
1006 }
1008
1007
1009 _hg_cmd_qdiff() {
1008 _hg_cmd_qdiff() {
1010 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
1009 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
1011 $_hg_ignore_space_opts \
1010 $_hg_ignore_space_opts \
1012 '*:pattern:_hg_files'
1011 '*:pattern:_hg_files'
1013 }
1012 }
1014
1013
1015 _hg_cmd_qfinish() {
1014 _hg_cmd_qfinish() {
1016 _arguments -s -w : $_hg_global_opts \
1015 _arguments -s -w : $_hg_global_opts \
1017 '(--applied -a)'{-a,--applied}'[finish all applied patches]' \
1016 '(--applied -a)'{-a,--applied}'[finish all applied patches]' \
1018 '*:patch:_hg_qapplied'
1017 '*:patch:_hg_qapplied'
1019 }
1018 }
1020
1019
1021 _hg_cmd_qfold() {
1020 _hg_cmd_qfold() {
1022 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
1021 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
1023 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
1022 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
1024 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
1023 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
1025 '--no-backup[do not save backup copies of files]' \
1024 '--no-backup[do not save backup copies of files]' \
1026 '*:unapplied patch:_hg_qunapplied'
1025 '*:unapplied patch:_hg_qunapplied'
1027 }
1026 }
1028
1027
1029 _hg_cmd_qgoto() {
1028 _hg_cmd_qgoto() {
1030 _arguments -s -w : $_hg_global_opts \
1029 _arguments -s -w : $_hg_global_opts \
1031 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
1030 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
1032 '--keep-changes[tolerate non-conflicting local changes]' \
1031 '--keep-changes[tolerate non-conflicting local changes]' \
1033 ':patch:_hg_qseries'
1032 ':patch:_hg_qseries'
1034 }
1033 }
1035
1034
1036 _hg_cmd_qguard() {
1035 _hg_cmd_qguard() {
1037 _arguments -s -w : $_hg_global_opts \
1036 _arguments -s -w : $_hg_global_opts \
1038 '(--list -l)'{-l,--list}'[list all patches and guards]' \
1037 '(--list -l)'{-l,--list}'[list all patches and guards]' \
1039 '(--none -n)'{-n,--none}'[drop all guards]' \
1038 '(--none -n)'{-n,--none}'[drop all guards]' \
1040 ':patch:_hg_qseries' \
1039 ':patch:_hg_qseries' \
1041 '*:guards:_hg_qguards'
1040 '*:guards:_hg_qguards'
1042 }
1041 }
1043
1042
1044 _hg_cmd_qheader() {
1043 _hg_cmd_qheader() {
1045 _arguments -s -w : $_hg_global_opts \
1044 _arguments -s -w : $_hg_global_opts \
1046 ':patch:_hg_qseries'
1045 ':patch:_hg_qseries'
1047 }
1046 }
1048
1047
1049 _hg_cmd_qimport() {
1048 _hg_cmd_qimport() {
1050 _arguments -s -w : $_hg_global_opts $_hg_gitlike_opts \
1049 _arguments -s -w : $_hg_global_opts $_hg_gitlike_opts \
1051 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
1050 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
1052 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
1051 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
1053 '(--force -f)'{-f,--force}'[overwrite existing files]' \
1052 '(--force -f)'{-f,--force}'[overwrite existing files]' \
1054 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
1053 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
1055 '(--push -P)'{-P,--push}'[qpush after importing]' \
1054 '(--push -P)'{-P,--push}'[qpush after importing]' \
1056 '*:patch:_files'
1055 '*:patch:_files'
1057 }
1056 }
1058
1057
1059 _hg_cmd_qnew() {
1058 _hg_cmd_qnew() {
1060 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
1059 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
1061 ':patch:'
1060 ':patch:'
1062 }
1061 }
1063
1062
1064 _hg_cmd_qnext() {
1063 _hg_cmd_qnext() {
1065 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
1064 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
1066 }
1065 }
1067
1066
1068 _hg_cmd_qpop() {
1067 _hg_cmd_qpop() {
1069 _arguments -s -w : $_hg_global_opts \
1068 _arguments -s -w : $_hg_global_opts \
1070 '(--all -a :)'{-a,--all}'[pop all patches]' \
1069 '(--all -a :)'{-a,--all}'[pop all patches]' \
1071 '(--force -f)'{-f,--force}'[forget any local changes]' \
1070 '(--force -f)'{-f,--force}'[forget any local changes]' \
1072 '--keep-changes[tolerate non-conflicting local changes]' \
1071 '--keep-changes[tolerate non-conflicting local changes]' \
1073 '--no-backup[do not save backup copies of files]' \
1072 '--no-backup[do not save backup copies of files]' \
1074 ':patch:_hg_qapplied'
1073 ':patch:_hg_qapplied'
1075 }
1074 }
1076
1075
1077 _hg_cmd_qprev() {
1076 _hg_cmd_qprev() {
1078 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
1077 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
1079 }
1078 }
1080
1079
1081 _hg_cmd_qpush() {
1080 _hg_cmd_qpush() {
1082 _arguments -s -w : $_hg_global_opts \
1081 _arguments -s -w : $_hg_global_opts \
1083 '(--all -a :)'{-a,--all}'[apply all patches]' \
1082 '(--all -a :)'{-a,--all}'[apply all patches]' \
1084 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
1083 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
1085 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
1084 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
1086 '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \
1085 '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \
1087 '--move[reorder patch series and apply only the patch]' \
1086 '--move[reorder patch series and apply only the patch]' \
1088 '--keep-changes[tolerate non-conflicting local changes]' \
1087 '--keep-changes[tolerate non-conflicting local changes]' \
1089 '--no-backup[do not save backup copies of files]' \
1088 '--no-backup[do not save backup copies of files]' \
1090 ':patch:_hg_qunapplied'
1089 ':patch:_hg_qunapplied'
1091 }
1090 }
1092
1091
1093 _hg_cmd_qrefresh() {
1092 _hg_cmd_qrefresh() {
1094 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_gitlike_opts \
1093 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_gitlike_opts \
1095 '(--short -s)'{-s,--short}'[short refresh]' \
1094 '(--short -s)'{-s,--short}'[short refresh]' \
1096 '*:files:_hg_files'
1095 '*:files:_hg_files'
1097 }
1096 }
1098
1097
1099 _hg_cmd_qrename() {
1098 _hg_cmd_qrename() {
1100 _arguments -s -w : $_hg_global_opts \
1099 _arguments -s -w : $_hg_global_opts \
1101 ':patch:_hg_qunapplied' \
1100 ':patch:_hg_qunapplied' \
1102 ':destination:'
1101 ':destination:'
1103 }
1102 }
1104
1103
1105 _hg_cmd_qselect() {
1104 _hg_cmd_qselect() {
1106 _arguments -s -w : $_hg_global_opts \
1105 _arguments -s -w : $_hg_global_opts \
1107 '(--none -n :)'{-n,--none}'[disable all guards]' \
1106 '(--none -n :)'{-n,--none}'[disable all guards]' \
1108 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
1107 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
1109 '--pop[pop to before first guarded applied patch]' \
1108 '--pop[pop to before first guarded applied patch]' \
1110 '--reapply[pop and reapply patches]' \
1109 '--reapply[pop and reapply patches]' \
1111 '*:guards:_hg_qguards'
1110 '*:guards:_hg_qguards'
1112 }
1111 }
1113
1112
1114 _hg_cmd_qseries() {
1113 _hg_cmd_qseries() {
1115 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
1114 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
1116 '(--missing -m)'{-m,--missing}'[print patches not in series]'
1115 '(--missing -m)'{-m,--missing}'[print patches not in series]'
1117 }
1116 }
1118
1117
1119 _hg_cmd_qunapplied() {
1118 _hg_cmd_qunapplied() {
1120 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
1119 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
1121 '(--first -1)'{-1,--first}'[show only the first patch]'
1120 '(--first -1)'{-1,--first}'[show only the first patch]'
1122 }
1121 }
1123
1122
1124 _hg_cmd_qtop() {
1123 _hg_cmd_qtop() {
1125 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
1124 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
1126 }
1125 }
1127
1126
1128 _hg_cmd_strip() {
1127 _hg_cmd_strip() {
1129 _arguments -s -w : $_hg_global_opts \
1128 _arguments -s -w : $_hg_global_opts \
1130 '(--force -f)'{-f,--force}'[force removal, discard uncommitted changes, no backup]' \
1129 '(--force -f)'{-f,--force}'[force removal, discard uncommitted changes, no backup]' \
1131 '(--no-backup -n)'{-n,--no-backup}'[no backups]' \
1130 '(--no-backup -n)'{-n,--no-backup}'[no backups]' \
1132 '(--keep -k)'{-k,--keep}'[do not modify working copy during strip]' \
1131 '(--keep -k)'{-k,--keep}'[do not modify working copy during strip]' \
1133 '(--bookmark -B)'{-B+,--bookmark}'[remove revs only reachable from given bookmark]:bookmark:_hg_bookmarks' \
1132 '(--bookmark -B)'{-B+,--bookmark}'[remove revs only reachable from given bookmark]:bookmark:_hg_bookmarks' \
1134 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
1133 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
1135 ':revision:_hg_labels'
1134 ':revision:_hg_labels'
1136 }
1135 }
1137
1136
1138 # Patchbomb
1137 # Patchbomb
1139 _hg_cmd_email() {
1138 _hg_cmd_email() {
1140 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_gitlike_opts \
1139 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_gitlike_opts \
1141 '--plain[omit hg patch header]' \
1140 '--plain[omit hg patch header]' \
1142 '--body[send patches as inline message text (default)]' \
1141 '--body[send patches as inline message text (default)]' \
1143 '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
1142 '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
1144 '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \
1143 '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \
1145 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
1144 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
1146 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
1145 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
1147 '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
1146 '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
1148 '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \
1147 '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \
1149 '--intro[send an introduction email for a single patch]' \
1148 '--intro[send an introduction email for a single patch]' \
1150 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
1149 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
1151 '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
1150 '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
1152 '*--bcc[email addresses of blind carbon copy recipients]:email:' \
1151 '*--bcc[email addresses of blind carbon copy recipients]:email:' \
1153 '*'{-c+,--cc}'[email addresses of copy recipients]:email:' \
1152 '*'{-c+,--cc}'[email addresses of copy recipients]:email:' \
1154 '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \
1153 '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \
1155 '--date[use the given date as the sending date]:date:' \
1154 '--date[use the given date as the sending date]:date:' \
1156 '--desc[use the given file as the series description]:files:_files' \
1155 '--desc[use the given file as the series description]:files:_files' \
1157 '(--from -f)'{-f,--from}'[email address of sender]:email:' \
1156 '(--from -f)'{-f,--from}'[email address of sender]:email:' \
1158 '(--test -n)'{-n,--test}'[print messages that would be sent]' \
1157 '(--test -n)'{-n,--test}'[print messages that would be sent]' \
1159 '(--mbox -m)'{-m,--mbox}'[write messages to mbox file instead of sending them]:file:' \
1158 '(--mbox -m)'{-m,--mbox}'[write messages to mbox file instead of sending them]:file:' \
1160 '*--reply-to[email addresses replies should be sent to]:email:' \
1159 '*--reply-to[email addresses replies should be sent to]:email:' \
1161 '(--subject -s)'{-s,--subject}'[subject of first message (intro or single patch)]:subject:' \
1160 '(--subject -s)'{-s,--subject}'[subject of first message (intro or single patch)]:subject:' \
1162 '--in-reply-to[message identifier to reply to]:msgid:' \
1161 '--in-reply-to[message identifier to reply to]:msgid:' \
1163 '*--flag[flags to add in subject prefixes]:flag:' \
1162 '*--flag[flags to add in subject prefixes]:flag:' \
1164 '*'{-t,--to}'[email addresses of recipients]:email:' \
1163 '*'{-t,--to}'[email addresses of recipients]:email:' \
1165 ':revision:_hg_revrange'
1164 ':revision:_hg_revrange'
1166 }
1165 }
1167
1166
1168 # Rebase
1167 # Rebase
1169 _hg_cmd_rebase() {
1168 _hg_cmd_rebase() {
1170 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts \
1169 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts \
1171 '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \
1170 '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \
1172 '(--source -s)'{-s+,--source}'[rebase from the specified changeset]:revision:_hg_labels' \
1171 '(--source -s)'{-s+,--source}'[rebase from the specified changeset]:revision:_hg_labels' \
1173 '(--base -b)'{-b+,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \
1172 '(--base -b)'{-b+,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \
1174 '(--dest -d)'{-d+,--dest}'[rebase onto the specified changeset]:revision:_hg_labels' \
1173 '(--dest -d)'{-d+,--dest}'[rebase onto the specified changeset]:revision:_hg_labels' \
1175 '--collapse[collapse the rebased changeset]' \
1174 '--collapse[collapse the rebased changeset]' \
1176 '--keep[keep original changeset]' \
1175 '--keep[keep original changeset]' \
1177 '--keepbranches[keep original branch name]' \
1176 '--keepbranches[keep original branch name]' \
1178 '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \
1177 '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \
1179 '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \
1178 '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \
1180 }
1179 }
1181
1180
1182 # Record
1181 # Record
1183 _hg_cmd_record() {
1182 _hg_cmd_record() {
1184 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_pat_opts \
1183 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_pat_opts \
1185 $_hg_ignore_space_opts $_hg_subrepos_opts \
1184 $_hg_ignore_space_opts $_hg_subrepos_opts \
1186 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
1185 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
1187 '--close-branch[mark a branch as closed, hiding it from the branch list]' \
1186 '--close-branch[mark a branch as closed, hiding it from the branch list]' \
1188 '--amend[amend the parent of the working dir]' \
1187 '--amend[amend the parent of the working dir]' \
1189 '(--date -d)'{-d+,--date}'[record the specified date as commit date]:date:' \
1188 '(--date -d)'{-d+,--date}'[record the specified date as commit date]:date:' \
1190 '(--user -u)'{-u+,--user}'[record the specified user as committer]:user:'
1189 '(--user -u)'{-u+,--user}'[record the specified user as committer]:user:'
1191 }
1190 }
1192
1191
1193 _hg_cmd_qrecord() {
1192 _hg_cmd_qrecord() {
1194 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
1193 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
1195 $_hg_pat_opts $_hg_ignore_space_opts $_hg_subrepos_opts
1194 $_hg_pat_opts $_hg_ignore_space_opts $_hg_subrepos_opts
1196 }
1195 }
1197
1196
1198 # Convert
1197 # Convert
1199 _hg_cmd_convert() {
1198 _hg_cmd_convert() {
1200 _arguments -s -w : $_hg_global_opts \
1199 _arguments -s -w : $_hg_global_opts \
1201 '(--source-type -s)'{-s,--source-type}'[source repository type]' \
1200 '(--source-type -s)'{-s,--source-type}'[source repository type]' \
1202 '(--dest-type -d)'{-d,--dest-type}'[destination repository type]' \
1201 '(--dest-type -d)'{-d,--dest-type}'[destination repository type]' \
1203 '(--rev -r)'{-r+,--rev}'[import up to target revision]:revision:' \
1202 '(--rev -r)'{-r+,--rev}'[import up to target revision]:revision:' \
1204 '(--authormap -A)'{-A+,--authormap}'[remap usernames using this file]:file:_files' \
1203 '(--authormap -A)'{-A+,--authormap}'[remap usernames using this file]:file:_files' \
1205 '--filemap[remap file names using contents of file]:file:_files' \
1204 '--filemap[remap file names using contents of file]:file:_files' \
1206 '--splicemap[splice synthesized history into place]:file:_files' \
1205 '--splicemap[splice synthesized history into place]:file:_files' \
1207 '--branchmap[change branch names while converting]:file:_files' \
1206 '--branchmap[change branch names while converting]:file:_files' \
1208 '--branchsort[try to sort changesets by branches]' \
1207 '--branchsort[try to sort changesets by branches]' \
1209 '--datesort[try to sort changesets by date]' \
1208 '--datesort[try to sort changesets by date]' \
1210 '--sourcesort[preserve source changesets order]'
1209 '--sourcesort[preserve source changesets order]'
1211 }
1210 }
1212
1211
1213 # Graphlog
1212 # Graphlog
1214 _hg_cmd_glog() {
1213 _hg_cmd_glog() {
1215 _hg_cmd_log $@
1214 _hg_cmd_log $@
1216 }
1215 }
1217
1216
1218 # Purge
1217 # Purge
1219 _hg_cmd_purge() {
1218 _hg_cmd_purge() {
1220 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
1219 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
1221 '(--abort-on-err -a)'{-a,--abort-on-err}'[abort if an error occurs]' \
1220 '(--abort-on-err -a)'{-a,--abort-on-err}'[abort if an error occurs]' \
1222 '--all[purge ignored files too]' \
1221 '--all[purge ignored files too]' \
1223 '(--print -p)'{-p,--print}'[print filenames instead of deleting them]' \
1222 '(--print -p)'{-p,--print}'[print filenames instead of deleting them]' \
1224 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs (implies -p/--print)]'
1223 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs (implies -p/--print)]'
1225 }
1224 }
1226
1225
1227 _hg "$@"
1226 _hg "$@"
General Comments 0
You need to be logged in to leave comments. Login now