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