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