##// END OF EJS Templates
zsh completion: remove computed default values from help texts...
Martin Geisler -
r13562:7c6e9b57 default
parent child Browse files
Show More
@@ -1,1010 +1,1010 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 }
168 }
169
169
170 _hg_tags() {
170 _hg_tags() {
171 typeset -a tags
171 typeset -a tags
172 local tag rev
172 local tag rev
173
173
174 _hg_cmd tags | while read tag
174 _hg_cmd tags | while read tag
175 do
175 do
176 tags+=(${tag/ # [0-9]#:*})
176 tags+=(${tag/ # [0-9]#:*})
177 done
177 done
178 (( $#tags )) && _describe -t tags 'tags' tags
178 (( $#tags )) && _describe -t tags 'tags' tags
179 }
179 }
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 # 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}\\n')"})
199 heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"})
200 # exclude own revision
200 # exclude own revision
201 myrev=$(_hg_cmd log -r . --template '{rev}\\n')
201 myrev=$(_hg_cmd log -r . --template '{rev}\\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
206
207 _hg_files() {
207 _hg_files() {
208 if [[ -n "$_hg_root" ]]
208 if [[ -n "$_hg_root" ]]
209 then
209 then
210 [[ -d "$_hg_root/.hg" ]] || return
210 [[ -d "$_hg_root/.hg" ]] || return
211 case "$_hg_root" in
211 case "$_hg_root" in
212 /*)
212 /*)
213 _files -W $_hg_root
213 _files -W $_hg_root
214 ;;
214 ;;
215 *)
215 *)
216 _files -W $PWD/$_hg_root
216 _files -W $PWD/$_hg_root
217 ;;
217 ;;
218 esac
218 esac
219 else
219 else
220 _files
220 _files
221 fi
221 fi
222 }
222 }
223
223
224 _hg_status() {
224 _hg_status() {
225 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
225 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
226 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
226 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
227 }
227 }
228
228
229 _hg_unknown() {
229 _hg_unknown() {
230 typeset -a status_files
230 typeset -a status_files
231 _hg_status u
231 _hg_status u
232 _wanted files expl 'unknown files' _multi_parts / status_files
232 _wanted files expl 'unknown files' _multi_parts / status_files
233 }
233 }
234
234
235 _hg_missing() {
235 _hg_missing() {
236 typeset -a status_files
236 typeset -a status_files
237 _hg_status d
237 _hg_status d
238 _wanted files expl 'missing files' _multi_parts / status_files
238 _wanted files expl 'missing files' _multi_parts / status_files
239 }
239 }
240
240
241 _hg_modified() {
241 _hg_modified() {
242 typeset -a status_files
242 typeset -a status_files
243 _hg_status m
243 _hg_status m
244 _wanted files expl 'modified files' _multi_parts / status_files
244 _wanted files expl 'modified files' _multi_parts / status_files
245 }
245 }
246
246
247 _hg_resolve() {
247 _hg_resolve() {
248 local rstate rpath
248 local rstate rpath
249
249
250 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
250 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
251
251
252 _hg_cmd resolve -l ./$PREFIX | while read rstate rpath
252 _hg_cmd resolve -l ./$PREFIX | while read rstate rpath
253 do
253 do
254 [[ $rstate == 'R' ]] && resolved_files+=($rpath)
254 [[ $rstate == 'R' ]] && resolved_files+=($rpath)
255 [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
255 [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
256 done
256 done
257 }
257 }
258
258
259 _hg_resolved() {
259 _hg_resolved() {
260 typeset -a resolved_files unresolved_files
260 typeset -a resolved_files unresolved_files
261 _hg_resolve
261 _hg_resolve
262 _wanted files expl 'resolved files' _multi_parts / resolved_files
262 _wanted files expl 'resolved files' _multi_parts / resolved_files
263 }
263 }
264
264
265 _hg_unresolved() {
265 _hg_unresolved() {
266 typeset -a resolved_files unresolved_files
266 typeset -a resolved_files unresolved_files
267 _hg_resolve
267 _hg_resolve
268 _wanted files expl 'unresolved files' _multi_parts / unresolved_files
268 _wanted files expl 'unresolved files' _multi_parts / unresolved_files
269 }
269 }
270
270
271 _hg_config() {
271 _hg_config() {
272 typeset -a items
272 typeset -a items
273 items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
273 items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
274 (( $#items )) && _describe -t config 'config item' items
274 (( $#items )) && _describe -t config 'config item' items
275 }
275 }
276
276
277 _hg_addremove() {
277 _hg_addremove() {
278 _alternative 'files:unknown files:_hg_unknown' \
278 _alternative 'files:unknown files:_hg_unknown' \
279 'files:missing files:_hg_missing'
279 'files:missing files:_hg_missing'
280 }
280 }
281
281
282 _hg_ssh_urls() {
282 _hg_ssh_urls() {
283 if [[ -prefix */ ]]
283 if [[ -prefix */ ]]
284 then
284 then
285 if zstyle -T ":completion:${curcontext}:files" remote-access
285 if zstyle -T ":completion:${curcontext}:files" remote-access
286 then
286 then
287 local host=${PREFIX%%/*}
287 local host=${PREFIX%%/*}
288 typeset -a remdirs
288 typeset -a remdirs
289 compset -p $(( $#host + 1 ))
289 compset -p $(( $#host + 1 ))
290 local rempath=${(M)PREFIX##*/}
290 local rempath=${(M)PREFIX##*/}
291 local cacheid="hg:${host}-${rempath//\//_}"
291 local cacheid="hg:${host}-${rempath//\//_}"
292 cacheid=${cacheid%[-_]}
292 cacheid=${cacheid%[-_]}
293 compset -P '*/'
293 compset -P '*/'
294 if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
294 if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
295 then
295 then
296 remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
296 remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
297 _store_cache "$cacheid" remdirs
297 _store_cache "$cacheid" remdirs
298 fi
298 fi
299 _describe -t directories 'remote directory' remdirs -S/
299 _describe -t directories 'remote directory' remdirs -S/
300 else
300 else
301 _message 'remote directory'
301 _message 'remote directory'
302 fi
302 fi
303 else
303 else
304 if compset -P '*@'
304 if compset -P '*@'
305 then
305 then
306 _hosts -S/
306 _hosts -S/
307 else
307 else
308 _alternative 'hosts:remote host name:_hosts -S/' \
308 _alternative 'hosts:remote host name:_hosts -S/' \
309 'users:user:_users -S@'
309 'users:user:_users -S@'
310 fi
310 fi
311 fi
311 fi
312 }
312 }
313
313
314 _hg_urls() {
314 _hg_urls() {
315 if compset -P bundle://
315 if compset -P bundle://
316 then
316 then
317 _files
317 _files
318 elif compset -P ssh://
318 elif compset -P ssh://
319 then
319 then
320 _hg_ssh_urls
320 _hg_ssh_urls
321 elif [[ -prefix *: ]]
321 elif [[ -prefix *: ]]
322 then
322 then
323 _urls
323 _urls
324 else
324 else
325 local expl
325 local expl
326 compset -S '[^:]*'
326 compset -S '[^:]*'
327 _wanted url-schemas expl 'URL schema' compadd -S '' - \
327 _wanted url-schemas expl 'URL schema' compadd -S '' - \
328 http:// https:// ssh:// bundle://
328 http:// https:// ssh:// bundle://
329 fi
329 fi
330 }
330 }
331
331
332 _hg_paths() {
332 _hg_paths() {
333 typeset -a paths pnames
333 typeset -a paths pnames
334 _hg_cmd paths | while read -A pnames
334 _hg_cmd paths | while read -A pnames
335 do
335 do
336 paths+=($pnames[1])
336 paths+=($pnames[1])
337 done
337 done
338 (( $#paths )) && _describe -t path-aliases 'repository alias' paths
338 (( $#paths )) && _describe -t path-aliases 'repository alias' paths
339 }
339 }
340
340
341 _hg_remote() {
341 _hg_remote() {
342 _alternative 'path-aliases:repository alias:_hg_paths' \
342 _alternative 'path-aliases:repository alias:_hg_paths' \
343 'directories:directory:_files -/' \
343 'directories:directory:_files -/' \
344 'urls:URL:_hg_urls'
344 'urls:URL:_hg_urls'
345 }
345 }
346
346
347 _hg_clone_dest() {
347 _hg_clone_dest() {
348 _alternative 'directories:directory:_files -/' \
348 _alternative 'directories:directory:_files -/' \
349 'urls:URL:_hg_urls'
349 'urls:URL:_hg_urls'
350 }
350 }
351
351
352 # Common options
352 # Common options
353 _hg_global_opts=(
353 _hg_global_opts=(
354 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
354 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
355 '--cwd[change working directory]:new working directory:_files -/'
355 '--cwd[change working directory]:new working directory:_files -/'
356 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
356 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
357 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
357 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
358 '*--config[set/override config option]:defined config items:_hg_config'
358 '*--config[set/override config option]:defined config items:_hg_config'
359 '(--quiet -q)'{-q,--quiet}'[suppress output]'
359 '(--quiet -q)'{-q,--quiet}'[suppress output]'
360 '(--help -h)'{-h,--help}'[display help and exit]'
360 '(--help -h)'{-h,--help}'[display help and exit]'
361 '--debug[debug mode]'
361 '--debug[debug mode]'
362 '--debugger[start debugger]'
362 '--debugger[start debugger]'
363 '--encoding[set the charset encoding (default: UTF8)]'
363 '--encoding[set the charset encoding]'
364 '--encodingmode[set the charset encoding mode (default: strict)]'
364 '--encodingmode[set the charset encoding mode]'
365 '--lsprof[print improved command execution profile]'
365 '--lsprof[print improved command execution profile]'
366 '--traceback[print traceback on exception]'
366 '--traceback[print traceback on exception]'
367 '--time[time how long the command takes]'
367 '--time[time how long the command takes]'
368 '--profile[profile]'
368 '--profile[profile]'
369 '--version[output version information and exit]'
369 '--version[output version information and exit]'
370 )
370 )
371
371
372 _hg_pat_opts=(
372 _hg_pat_opts=(
373 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
373 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
374 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
374 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
375
375
376 _hg_diff_opts=(
376 _hg_diff_opts=(
377 '(--text -a)'{-a,--text}'[treat all files as text]'
377 '(--text -a)'{-a,--text}'[treat all files as text]'
378 '(--git -g)'{-g,--git}'[use git extended diff format]'
378 '(--git -g)'{-g,--git}'[use git extended diff format]'
379 "--nodates[omit dates from diff headers]")
379 "--nodates[omit dates from diff headers]")
380
380
381 _hg_dryrun_opts=(
381 _hg_dryrun_opts=(
382 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
382 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
383
383
384 _hg_style_opts=(
384 _hg_style_opts=(
385 '--style[display using template map file]:'
385 '--style[display using template map file]:'
386 '--template[display with template]:')
386 '--template[display with template]:')
387
387
388 _hg_commit_opts=(
388 _hg_commit_opts=(
389 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
389 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
390 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
390 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
391 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
391 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
392
392
393 _hg_remote_opts=(
393 _hg_remote_opts=(
394 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
394 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
395 '--remotecmd[specify hg command to run on the remote side]:')
395 '--remotecmd[specify hg command to run on the remote side]:')
396
396
397 _hg_cmd() {
397 _hg_cmd() {
398 _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
398 _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
399 }
399 }
400
400
401 _hg_cmd_add() {
401 _hg_cmd_add() {
402 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
402 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
403 '*:unknown files:_hg_unknown'
403 '*:unknown files:_hg_unknown'
404 }
404 }
405
405
406 _hg_cmd_addremove() {
406 _hg_cmd_addremove() {
407 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
407 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
408 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
408 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
409 '*:unknown or missing files:_hg_addremove'
409 '*:unknown or missing files:_hg_addremove'
410 }
410 }
411
411
412 _hg_cmd_annotate() {
412 _hg_cmd_annotate() {
413 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
413 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
414 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \
414 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \
415 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
415 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
416 '(--text -a)'{-a,--text}'[treat all files as text]' \
416 '(--text -a)'{-a,--text}'[treat all files as text]' \
417 '(--user -u)'{-u,--user}'[list the author]' \
417 '(--user -u)'{-u,--user}'[list the author]' \
418 '(--date -d)'{-d,--date}'[list the date]' \
418 '(--date -d)'{-d,--date}'[list the date]' \
419 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
419 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
420 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
420 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
421 '*:files:_hg_files'
421 '*:files:_hg_files'
422 }
422 }
423
423
424 _hg_cmd_archive() {
424 _hg_cmd_archive() {
425 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
425 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
426 '--no-decode[do not pass files through decoders]' \
426 '--no-decode[do not pass files through decoders]' \
427 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
427 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
428 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \
428 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \
429 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
429 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
430 '*:destination:_files'
430 '*:destination:_files'
431 }
431 }
432
432
433 _hg_cmd_backout() {
433 _hg_cmd_backout() {
434 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
434 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
435 '--merge[merge with old dirstate parent after backout]' \
435 '--merge[merge with old dirstate parent after backout]' \
436 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
436 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
437 '--parent[parent to choose when backing out merge]' \
437 '--parent[parent to choose when backing out merge]' \
438 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
438 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
439 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
439 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
440 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
440 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
441 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
441 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
442 }
442 }
443
443
444 _hg_cmd_bisect() {
444 _hg_cmd_bisect() {
445 _arguments -s -w : $_hg_global_opts \
445 _arguments -s -w : $_hg_global_opts \
446 '(-)'{-r,--reset}'[reset bisect state]' \
446 '(-)'{-r,--reset}'[reset bisect state]' \
447 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
447 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
448 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
448 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
449 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
449 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
450 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
450 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
451 '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
451 '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
452 }
452 }
453
453
454 _hg_cmd_bookmarks() {
454 _hg_cmd_bookmarks() {
455 _arguments -s -w : $_hg_global_opts \
455 _arguments -s -w : $_hg_global_opts \
456 '(--force -f)'{-f,--force}'[force]' \
456 '(--force -f)'{-f,--force}'[force]' \
457 '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \
457 '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \
458 '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
458 '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
459 '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
459 '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
460 ':bookmark:_hg_bookmarks'
460 ':bookmark:_hg_bookmarks'
461 }
461 }
462
462
463 _hg_cmd_branch() {
463 _hg_cmd_branch() {
464 _arguments -s -w : $_hg_global_opts \
464 _arguments -s -w : $_hg_global_opts \
465 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
465 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
466 '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
466 '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
467 }
467 }
468
468
469 _hg_cmd_branches() {
469 _hg_cmd_branches() {
470 _arguments -s -w : $_hg_global_opts \
470 _arguments -s -w : $_hg_global_opts \
471 '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]'
471 '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]'
472 }
472 }
473
473
474 _hg_cmd_bundle() {
474 _hg_cmd_bundle() {
475 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
475 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
476 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
476 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
477 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \
477 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \
478 ':output file:_files' \
478 ':output file:_files' \
479 ':destination repository:_files -/'
479 ':destination repository:_files -/'
480 }
480 }
481
481
482 _hg_cmd_cat() {
482 _hg_cmd_cat() {
483 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
483 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
484 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
484 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
485 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
485 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
486 '*:file:_hg_files'
486 '*:file:_hg_files'
487 }
487 }
488
488
489 _hg_cmd_clone() {
489 _hg_cmd_clone() {
490 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
490 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
491 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
491 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
492 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
492 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
493 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
493 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
494 ':source repository:_hg_remote' \
494 ':source repository:_hg_remote' \
495 ':destination:_hg_clone_dest'
495 ':destination:_hg_clone_dest'
496 }
496 }
497
497
498 _hg_cmd_commit() {
498 _hg_cmd_commit() {
499 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
499 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
500 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
500 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
501 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
501 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
502 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
502 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
503 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
503 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
504 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
504 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
505 '*:file:_hg_files'
505 '*:file:_hg_files'
506 }
506 }
507
507
508 _hg_cmd_copy() {
508 _hg_cmd_copy() {
509 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
509 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
510 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
510 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
511 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
511 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
512 '*:file:_hg_files'
512 '*:file:_hg_files'
513 }
513 }
514
514
515 _hg_cmd_diff() {
515 _hg_cmd_diff() {
516 typeset -A opt_args
516 typeset -A opt_args
517 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
517 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
518 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
518 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
519 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
519 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
520 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
520 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
521 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
521 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
522 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
522 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
523 '*:file:->diff_files'
523 '*:file:->diff_files'
524
524
525 if [[ $state == 'diff_files' ]]
525 if [[ $state == 'diff_files' ]]
526 then
526 then
527 if [[ -n $opt_args[-r] ]]
527 if [[ -n $opt_args[-r] ]]
528 then
528 then
529 _hg_files
529 _hg_files
530 else
530 else
531 _hg_modified
531 _hg_modified
532 fi
532 fi
533 fi
533 fi
534 }
534 }
535
535
536 _hg_cmd_export() {
536 _hg_cmd_export() {
537 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
537 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
538 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
538 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
539 '--switch-parent[diff against the second parent]' \
539 '--switch-parent[diff against the second parent]' \
540 '*:revision:_hg_labels'
540 '*:revision:_hg_labels'
541 }
541 }
542
542
543 _hg_cmd_grep() {
543 _hg_cmd_grep() {
544 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
544 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
545 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
545 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
546 '--all[print all revisions with matches]' \
546 '--all[print all revisions with matches]' \
547 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
547 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
548 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
548 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
549 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
549 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
550 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
550 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
551 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
551 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
552 '(--user -u)'{-u,--user}'[print user who committed change]' \
552 '(--user -u)'{-u,--user}'[print user who committed change]' \
553 '1:search pattern:' \
553 '1:search pattern:' \
554 '*:files:_hg_files'
554 '*:files:_hg_files'
555 }
555 }
556
556
557 _hg_cmd_heads() {
557 _hg_cmd_heads() {
558 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
558 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
559 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels'
559 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels'
560 }
560 }
561
561
562 _hg_cmd_help() {
562 _hg_cmd_help() {
563 _arguments -s -w : $_hg_global_opts \
563 _arguments -s -w : $_hg_global_opts \
564 '*:mercurial command:_hg_commands'
564 '*:mercurial command:_hg_commands'
565 }
565 }
566
566
567 _hg_cmd_identify() {
567 _hg_cmd_identify() {
568 _arguments -s -w : $_hg_global_opts \
568 _arguments -s -w : $_hg_global_opts \
569 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \
569 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \
570 '(--num -n)'{-n+,--num}'[show local revision number]' \
570 '(--num -n)'{-n+,--num}'[show local revision number]' \
571 '(--id -i)'{-i+,--id}'[show global revision id]' \
571 '(--id -i)'{-i+,--id}'[show global revision id]' \
572 '(--branch -b)'{-b+,--branch}'[show branch]' \
572 '(--branch -b)'{-b+,--branch}'[show branch]' \
573 '(--tags -t)'{-t+,--tags}'[show tags]'
573 '(--tags -t)'{-t+,--tags}'[show tags]'
574 }
574 }
575
575
576 _hg_cmd_import() {
576 _hg_cmd_import() {
577 _arguments -s -w : $_hg_global_opts \
577 _arguments -s -w : $_hg_global_opts \
578 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
578 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
579 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
579 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
580 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
580 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
581 '*:patch:_files'
581 '*:patch:_files'
582 }
582 }
583
583
584 _hg_cmd_incoming() {
584 _hg_cmd_incoming() {
585 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
585 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
586 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
586 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
587 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
587 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
588 '(--patch -p)'{-p,--patch}'[show patch]' \
588 '(--patch -p)'{-p,--patch}'[show patch]' \
589 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
589 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
590 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
590 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
591 '--bundle[file to store the bundles into]:bundle file:_files' \
591 '--bundle[file to store the bundles into]:bundle file:_files' \
592 ':source:_hg_remote'
592 ':source:_hg_remote'
593 }
593 }
594
594
595 _hg_cmd_init() {
595 _hg_cmd_init() {
596 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
596 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
597 ':dir:_files -/'
597 ':dir:_files -/'
598 }
598 }
599
599
600 _hg_cmd_locate() {
600 _hg_cmd_locate() {
601 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
601 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
602 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \
602 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \
603 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
603 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
604 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
604 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
605 '*:search pattern:_hg_files'
605 '*:search pattern:_hg_files'
606 }
606 }
607
607
608 _hg_cmd_log() {
608 _hg_cmd_log() {
609 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
609 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
610 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
610 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
611 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
611 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
612 '(--copies -C)'{-C,--copies}'[show copied files]' \
612 '(--copies -C)'{-C,--copies}'[show copied files]' \
613 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
613 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
614 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
614 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
615 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
615 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
616 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
616 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
617 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
617 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
618 '(--patch -p)'{-p,--patch}'[show patch]' \
618 '(--patch -p)'{-p,--patch}'[show patch]' \
619 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
619 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
620 '*:files:_hg_files'
620 '*:files:_hg_files'
621 }
621 }
622
622
623 _hg_cmd_manifest() {
623 _hg_cmd_manifest() {
624 _arguments -s -w : $_hg_global_opts \
624 _arguments -s -w : $_hg_global_opts \
625 ':revision:_hg_labels'
625 ':revision:_hg_labels'
626 }
626 }
627
627
628 _hg_cmd_merge() {
628 _hg_cmd_merge() {
629 _arguments -s -w : $_hg_global_opts \
629 _arguments -s -w : $_hg_global_opts \
630 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
630 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
631 '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
631 '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
632 '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
632 '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
633 ':revision:_hg_mergerevs'
633 ':revision:_hg_mergerevs'
634 }
634 }
635
635
636 _hg_cmd_outgoing() {
636 _hg_cmd_outgoing() {
637 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
637 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
638 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
638 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
639 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
639 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
640 '(--patch -p)'{-p,--patch}'[show patch]' \
640 '(--patch -p)'{-p,--patch}'[show patch]' \
641 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
641 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
642 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
642 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
643 ':destination:_hg_remote'
643 ':destination:_hg_remote'
644 }
644 }
645
645
646 _hg_cmd_parents() {
646 _hg_cmd_parents() {
647 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
647 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
648 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \
648 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \
649 ':last modified file:_hg_files'
649 ':last modified file:_hg_files'
650 }
650 }
651
651
652 _hg_cmd_paths() {
652 _hg_cmd_paths() {
653 _arguments -s -w : $_hg_global_opts \
653 _arguments -s -w : $_hg_global_opts \
654 ':path:_hg_paths'
654 ':path:_hg_paths'
655 }
655 }
656
656
657 _hg_cmd_pull() {
657 _hg_cmd_pull() {
658 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
658 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
659 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
659 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
660 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
660 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
661 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
661 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
662 ':source:_hg_remote'
662 ':source:_hg_remote'
663 }
663 }
664
664
665 _hg_cmd_push() {
665 _hg_cmd_push() {
666 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
666 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
667 '(--force -f)'{-f,--force}'[force push]' \
667 '(--force -f)'{-f,--force}'[force push]' \
668 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \
668 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \
669 ':destination:_hg_remote'
669 ':destination:_hg_remote'
670 }
670 }
671
671
672 _hg_cmd_remove() {
672 _hg_cmd_remove() {
673 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
673 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
674 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
674 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
675 '(--force -f)'{-f,--force}'[remove file even if modified]' \
675 '(--force -f)'{-f,--force}'[remove file even if modified]' \
676 '*:file:_hg_files'
676 '*:file:_hg_files'
677 }
677 }
678
678
679 _hg_cmd_rename() {
679 _hg_cmd_rename() {
680 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
680 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
681 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
681 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
682 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
682 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
683 '*:file:_hg_files'
683 '*:file:_hg_files'
684 }
684 }
685
685
686 _hg_cmd_resolve() {
686 _hg_cmd_resolve() {
687 local context state line
687 local context state line
688 typeset -A opt_args
688 typeset -A opt_args
689
689
690 _arguments -s -w : $_hg_global_opts \
690 _arguments -s -w : $_hg_global_opts \
691 '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
691 '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
692 '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
692 '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
693 '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
693 '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
694 '*:file:_hg_unresolved'
694 '*:file:_hg_unresolved'
695
695
696 if [[ $state == 'resolve_files' ]]
696 if [[ $state == 'resolve_files' ]]
697 then
697 then
698 _alternative 'files:resolved files:_hg_resolved' \
698 _alternative 'files:resolved files:_hg_resolved' \
699 'files:unresolved files:_hg_unresolved'
699 'files:unresolved files:_hg_unresolved'
700 fi
700 fi
701 }
701 }
702
702
703 _hg_cmd_revert() {
703 _hg_cmd_revert() {
704 local context state line
704 local context state line
705 typeset -A opt_args
705 typeset -A opt_args
706
706
707 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
707 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
708 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
708 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
709 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \
709 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \
710 '--no-backup[do not save backup copies of files]' \
710 '--no-backup[do not save backup copies of files]' \
711 '*:file:->diff_files'
711 '*:file:->diff_files'
712
712
713 if [[ $state == 'diff_files' ]]
713 if [[ $state == 'diff_files' ]]
714 then
714 then
715 if [[ -n $opt_args[-r] ]]
715 if [[ -n $opt_args[-r] ]]
716 then
716 then
717 _hg_files
717 _hg_files
718 else
718 else
719 typeset -a status_files
719 typeset -a status_files
720 _hg_status mard
720 _hg_status mard
721 _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
721 _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
722 fi
722 fi
723 fi
723 fi
724 }
724 }
725
725
726 _hg_cmd_serve() {
726 _hg_cmd_serve() {
727 _arguments -s -w : $_hg_global_opts \
727 _arguments -s -w : $_hg_global_opts \
728 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
728 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
729 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
729 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
730 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
730 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
731 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
731 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
732 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
732 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
733 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
733 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
734 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
734 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
735 '--style[web template style]:style' \
735 '--style[web template style]:style' \
736 '--stdio[for remote clients]' \
736 '--stdio[for remote clients]' \
737 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
737 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
738 }
738 }
739
739
740 _hg_cmd_showconfig() {
740 _hg_cmd_showconfig() {
741 _arguments -s -w : $_hg_global_opts \
741 _arguments -s -w : $_hg_global_opts \
742 '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \
742 '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \
743 ':config item:_hg_config'
743 ':config item:_hg_config'
744 }
744 }
745
745
746 _hg_cmd_status() {
746 _hg_cmd_status() {
747 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
747 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
748 '(--all -A)'{-A,--all}'[show status of all files]' \
748 '(--all -A)'{-A,--all}'[show status of all files]' \
749 '(--modified -m)'{-m,--modified}'[show only modified files]' \
749 '(--modified -m)'{-m,--modified}'[show only modified files]' \
750 '(--added -a)'{-a,--added}'[show only added files]' \
750 '(--added -a)'{-a,--added}'[show only added files]' \
751 '(--removed -r)'{-r,--removed}'[show only removed files]' \
751 '(--removed -r)'{-r,--removed}'[show only removed files]' \
752 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
752 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
753 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
753 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
754 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
754 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
755 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
755 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
756 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
756 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
757 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
757 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
758 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
758 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
759 '--rev[show difference from revision]:revision:_hg_labels' \
759 '--rev[show difference from revision]:revision:_hg_labels' \
760 '*:files:_files'
760 '*:files:_files'
761 }
761 }
762
762
763 _hg_cmd_summary() {
763 _hg_cmd_summary() {
764 _arguments -s -w : $_hg_global_opts \
764 _arguments -s -w : $_hg_global_opts \
765 '--remote[check for push and pull]'
765 '--remote[check for push and pull]'
766 }
766 }
767
767
768 _hg_cmd_tag() {
768 _hg_cmd_tag() {
769 _arguments -s -w : $_hg_global_opts \
769 _arguments -s -w : $_hg_global_opts \
770 '(--local -l)'{-l,--local}'[make the tag local]' \
770 '(--local -l)'{-l,--local}'[make the tag local]' \
771 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
771 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
772 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
772 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
773 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
773 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
774 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \
774 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \
775 ':tag name:'
775 ':tag name:'
776 }
776 }
777
777
778 _hg_cmd_tip() {
778 _hg_cmd_tip() {
779 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
779 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
780 '(--patch -p)'{-p,--patch}'[show patch]'
780 '(--patch -p)'{-p,--patch}'[show patch]'
781 }
781 }
782
782
783 _hg_cmd_unbundle() {
783 _hg_cmd_unbundle() {
784 _arguments -s -w : $_hg_global_opts \
784 _arguments -s -w : $_hg_global_opts \
785 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
785 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
786 ':files:_files'
786 ':files:_files'
787 }
787 }
788
788
789 _hg_cmd_update() {
789 _hg_cmd_update() {
790 _arguments -s -w : $_hg_global_opts \
790 _arguments -s -w : $_hg_global_opts \
791 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
791 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
792 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
792 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
793 ':revision:_hg_labels'
793 ':revision:_hg_labels'
794 }
794 }
795
795
796 ## extensions ##
796 ## extensions ##
797
797
798 # HGK
798 # HGK
799 _hg_cmd_view() {
799 _hg_cmd_view() {
800 _arguments -s -w : $_hg_global_opts \
800 _arguments -s -w : $_hg_global_opts \
801 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
801 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
802 ':revision range:_hg_tags'
802 ':revision range:_hg_tags'
803 }
803 }
804
804
805 # MQ
805 # MQ
806 _hg_qseries() {
806 _hg_qseries() {
807 typeset -a patches
807 typeset -a patches
808 patches=(${(f)"$(_hg_cmd qseries)"})
808 patches=(${(f)"$(_hg_cmd qseries)"})
809 (( $#patches )) && _describe -t hg-patches 'patches' patches
809 (( $#patches )) && _describe -t hg-patches 'patches' patches
810 }
810 }
811
811
812 _hg_qapplied() {
812 _hg_qapplied() {
813 typeset -a patches
813 typeset -a patches
814 patches=(${(f)"$(_hg_cmd qapplied)"})
814 patches=(${(f)"$(_hg_cmd qapplied)"})
815 if (( $#patches ))
815 if (( $#patches ))
816 then
816 then
817 patches+=(qbase qtip)
817 patches+=(qbase qtip)
818 _describe -t hg-applied-patches 'applied patches' patches
818 _describe -t hg-applied-patches 'applied patches' patches
819 fi
819 fi
820 }
820 }
821
821
822 _hg_qunapplied() {
822 _hg_qunapplied() {
823 typeset -a patches
823 typeset -a patches
824 patches=(${(f)"$(_hg_cmd qunapplied)"})
824 patches=(${(f)"$(_hg_cmd qunapplied)"})
825 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
825 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
826 }
826 }
827
827
828 # unapplied, including guarded patches
828 # unapplied, including guarded patches
829 _hg_qdeletable() {
829 _hg_qdeletable() {
830 typeset -a unapplied
830 typeset -a unapplied
831 unapplied=(${(f)"$(_hg_cmd qseries)"})
831 unapplied=(${(f)"$(_hg_cmd qseries)"})
832 for p in $(_hg_cmd qapplied)
832 for p in $(_hg_cmd qapplied)
833 do
833 do
834 unapplied=(${unapplied:#$p})
834 unapplied=(${unapplied:#$p})
835 done
835 done
836
836
837 (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
837 (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
838 }
838 }
839
839
840 _hg_qguards() {
840 _hg_qguards() {
841 typeset -a guards
841 typeset -a guards
842 local guard
842 local guard
843 compset -P "+|-"
843 compset -P "+|-"
844 _hg_cmd qselect -s | while read guard
844 _hg_cmd qselect -s | while read guard
845 do
845 do
846 guards+=(${guard#(+|-)})
846 guards+=(${guard#(+|-)})
847 done
847 done
848 (( $#guards )) && _describe -t hg-guards 'guards' guards
848 (( $#guards )) && _describe -t hg-guards 'guards' guards
849 }
849 }
850
850
851 _hg_qseries_opts=(
851 _hg_qseries_opts=(
852 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
852 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
853
853
854 _hg_cmd_qapplied() {
854 _hg_cmd_qapplied() {
855 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
855 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
856 }
856 }
857
857
858 _hg_cmd_qdelete() {
858 _hg_cmd_qdelete() {
859 _arguments -s -w : $_hg_global_opts \
859 _arguments -s -w : $_hg_global_opts \
860 '(--keep -k)'{-k,--keep}'[keep patch file]' \
860 '(--keep -k)'{-k,--keep}'[keep patch file]' \
861 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
861 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
862 '*:unapplied patch:_hg_qdeletable'
862 '*:unapplied patch:_hg_qdeletable'
863 }
863 }
864
864
865 _hg_cmd_qdiff() {
865 _hg_cmd_qdiff() {
866 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
866 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
867 '*:pattern:_hg_files'
867 '*:pattern:_hg_files'
868 }
868 }
869
869
870 _hg_cmd_qfold() {
870 _hg_cmd_qfold() {
871 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
871 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
872 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
872 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
873 '*:unapplied patch:_hg_qunapplied'
873 '*:unapplied patch:_hg_qunapplied'
874 }
874 }
875
875
876 _hg_cmd_qgoto() {
876 _hg_cmd_qgoto() {
877 _arguments -s -w : $_hg_global_opts \
877 _arguments -s -w : $_hg_global_opts \
878 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
878 '(--force -f)'{-f,--force}'[overwrite any local changes]' \
879 ':patch:_hg_qseries'
879 ':patch:_hg_qseries'
880 }
880 }
881
881
882 _hg_cmd_qguard() {
882 _hg_cmd_qguard() {
883 _arguments -s -w : $_hg_global_opts \
883 _arguments -s -w : $_hg_global_opts \
884 '(--list -l)'{-l,--list}'[list all patches and guards]' \
884 '(--list -l)'{-l,--list}'[list all patches and guards]' \
885 '(--none -n)'{-n,--none}'[drop all guards]' \
885 '(--none -n)'{-n,--none}'[drop all guards]' \
886 ':patch:_hg_qseries' \
886 ':patch:_hg_qseries' \
887 '*:guards:_hg_qguards'
887 '*:guards:_hg_qguards'
888 }
888 }
889
889
890 _hg_cmd_qheader() {
890 _hg_cmd_qheader() {
891 _arguments -s -w : $_hg_global_opts \
891 _arguments -s -w : $_hg_global_opts \
892 ':patch:_hg_qseries'
892 ':patch:_hg_qseries'
893 }
893 }
894
894
895 _hg_cmd_qimport() {
895 _hg_cmd_qimport() {
896 _arguments -s -w : $_hg_global_opts \
896 _arguments -s -w : $_hg_global_opts \
897 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
897 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
898 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
898 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
899 '(--force -f)'{-f,--force}'[overwrite existing files]' \
899 '(--force -f)'{-f,--force}'[overwrite existing files]' \
900 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
900 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
901 '*:patch:_files'
901 '*:patch:_files'
902 }
902 }
903
903
904 _hg_cmd_qnew() {
904 _hg_cmd_qnew() {
905 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
905 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
906 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
906 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
907 ':patch:'
907 ':patch:'
908 }
908 }
909
909
910 _hg_cmd_qnext() {
910 _hg_cmd_qnext() {
911 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
911 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
912 }
912 }
913
913
914 _hg_cmd_qpop() {
914 _hg_cmd_qpop() {
915 _arguments -s -w : $_hg_global_opts \
915 _arguments -s -w : $_hg_global_opts \
916 '(--all -a :)'{-a,--all}'[pop all patches]' \
916 '(--all -a :)'{-a,--all}'[pop all patches]' \
917 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
917 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
918 '(--force -f)'{-f,--force}'[forget any local changes]' \
918 '(--force -f)'{-f,--force}'[forget any local changes]' \
919 ':patch:_hg_qapplied'
919 ':patch:_hg_qapplied'
920 }
920 }
921
921
922 _hg_cmd_qprev() {
922 _hg_cmd_qprev() {
923 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
923 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
924 }
924 }
925
925
926 _hg_cmd_qpush() {
926 _hg_cmd_qpush() {
927 _arguments -s -w : $_hg_global_opts \
927 _arguments -s -w : $_hg_global_opts \
928 '(--all -a :)'{-a,--all}'[apply all patches]' \
928 '(--all -a :)'{-a,--all}'[apply all patches]' \
929 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
929 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
930 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
930 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
931 '(--name -n)'{-n+,--name}'[merge queue name]:' \
931 '(--name -n)'{-n+,--name}'[merge queue name]:' \
932 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
932 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
933 '--move[reorder patch series and apply only the patch]' \
933 '--move[reorder patch series and apply only the patch]' \
934 ':patch:_hg_qunapplied'
934 ':patch:_hg_qunapplied'
935 }
935 }
936
936
937 _hg_cmd_qrefresh() {
937 _hg_cmd_qrefresh() {
938 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
938 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
939 '(--git -g)'{-g,--git}'[use git extended diff format]' \
939 '(--git -g)'{-g,--git}'[use git extended diff format]' \
940 '(--short -s)'{-s,--short}'[short refresh]' \
940 '(--short -s)'{-s,--short}'[short refresh]' \
941 '*:files:_hg_files'
941 '*:files:_hg_files'
942 }
942 }
943
943
944 _hg_cmd_qrename() {
944 _hg_cmd_qrename() {
945 _arguments -s -w : $_hg_global_opts \
945 _arguments -s -w : $_hg_global_opts \
946 ':patch:_hg_qseries' \
946 ':patch:_hg_qseries' \
947 ':destination:'
947 ':destination:'
948 }
948 }
949
949
950 _hg_cmd_qselect() {
950 _hg_cmd_qselect() {
951 _arguments -s -w : $_hg_global_opts \
951 _arguments -s -w : $_hg_global_opts \
952 '(--none -n :)'{-n,--none}'[disable all guards]' \
952 '(--none -n :)'{-n,--none}'[disable all guards]' \
953 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
953 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
954 '--pop[pop to before first guarded applied patch]' \
954 '--pop[pop to before first guarded applied patch]' \
955 '--reapply[pop and reapply patches]' \
955 '--reapply[pop and reapply patches]' \
956 '*:guards:_hg_qguards'
956 '*:guards:_hg_qguards'
957 }
957 }
958
958
959 _hg_cmd_qseries() {
959 _hg_cmd_qseries() {
960 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
960 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
961 '(--missing -m)'{-m,--missing}'[print patches not in series]'
961 '(--missing -m)'{-m,--missing}'[print patches not in series]'
962 }
962 }
963
963
964 _hg_cmd_qunapplied() {
964 _hg_cmd_qunapplied() {
965 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
965 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
966 }
966 }
967
967
968 _hg_cmd_qtop() {
968 _hg_cmd_qtop() {
969 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
969 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
970 }
970 }
971
971
972 _hg_cmd_strip() {
972 _hg_cmd_strip() {
973 _arguments -s -w : $_hg_global_opts \
973 _arguments -s -w : $_hg_global_opts \
974 '(--force -f)'{-f,--force}'[force multi-head removal]' \
974 '(--force -f)'{-f,--force}'[force multi-head removal]' \
975 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
975 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
976 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
976 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
977 ':revision:_hg_labels'
977 ':revision:_hg_labels'
978 }
978 }
979
979
980 # Patchbomb
980 # Patchbomb
981 _hg_cmd_email() {
981 _hg_cmd_email() {
982 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
982 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
983 '(--git -g)'{-g,--git}'[use git extended diff format]' \
983 '(--git -g)'{-g,--git}'[use git extended diff format]' \
984 '--plain[omit hg patch header]' \
984 '--plain[omit hg patch header]' \
985 '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
985 '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
986 '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \
986 '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \
987 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
987 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
988 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
988 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
989 '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
989 '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
990 '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \
990 '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \
991 '--intro[send an introduction email for a single patch]' \
991 '--intro[send an introduction email for a single patch]' \
992 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
992 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
993 '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
993 '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
994 '*--bcc[email addresses of blind carbon copy recipients]:email:' \
994 '*--bcc[email addresses of blind carbon copy recipients]:email:' \
995 '*'{-c+,--cc}'[email addresses of copy recipients]:email:' \
995 '*'{-c+,--cc}'[email addresses of copy recipients]:email:' \
996 '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \
996 '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \
997 '--date[use the given date as the sending date]:date:' \
997 '--date[use the given date as the sending date]:date:' \
998 '--desc[use the given file as the series description]:files:_files' \
998 '--desc[use the given file as the series description]:files:_files' \
999 '(--from -f)'{-f,--from}'[email address of sender]:email:' \
999 '(--from -f)'{-f,--from}'[email address of sender]:email:' \
1000 '(--test -n)'{-n,--test}'[print messages that would be sent]' \
1000 '(--test -n)'{-n,--test}'[print messages that would be sent]' \
1001 '(--mbox -m)'{-m,--mbox}'[write messages to mbox file instead of sending them]:file:' \
1001 '(--mbox -m)'{-m,--mbox}'[write messages to mbox file instead of sending them]:file:' \
1002 '*--reply-to[email addresses replies should be sent to]:email:' \
1002 '*--reply-to[email addresses replies should be sent to]:email:' \
1003 '(--subject -s)'{-s,--subject}'[subject of first message (intro or single patch)]:subject:' \
1003 '(--subject -s)'{-s,--subject}'[subject of first message (intro or single patch)]:subject:' \
1004 '--in-reply-to[message identifier to reply to]:msgid:' \
1004 '--in-reply-to[message identifier to reply to]:msgid:' \
1005 '*--flag[flags to add in subject prefixes]:flag:' \
1005 '*--flag[flags to add in subject prefixes]:flag:' \
1006 '*'{-t,--to}'[email addresses of recipients]:email:' \
1006 '*'{-t,--to}'[email addresses of recipients]:email:' \
1007 ':revision:_hg_revrange'
1007 ':revision:_hg_revrange'
1008 }
1008 }
1009
1009
1010 _hg "$@"
1010 _hg "$@"
General Comments 0
You need to be logged in to leave comments. Login now