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