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