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