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