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