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