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