##// END OF EJS Templates
zsh: add revrange completion
Brendan Cully -
r3550:ef80b13d default
parent child Browse files
Show More
@@ -1,655 +1,660 b''
1 #compdef hg
1 #compdef hg
2
2
3 # Zsh completion script for mercurial. Rename this file to _hg and copy
3 # Zsh completion script for mercurial. Rename this file to _hg and copy
4 # it into your zsh function path (/usr/share/zsh/site-functions for
4 # it into your zsh function path (/usr/share/zsh/site-functions for
5 # instance)
5 # instance)
6 #
6 #
7 # Copyright (C) 2005 Steve Borho
7 # Copyright (C) 2005 Steve Borho
8 # Copyright (C) 2006 Brendan Cully <brendan@kublai.com>
8 # Copyright (C) 2006 Brendan Cully <brendan@kublai.com>
9 #
9 #
10 # This is free software; you can redistribute it and/or modify it under
10 # This is free software; you can redistribute it and/or modify it under
11 # the terms of the GNU General Public License as published by the Free
11 # the terms of the GNU General Public License as published by the Free
12 # Software Foundation; either version 2 of the License, or (at your
12 # Software Foundation; either version 2 of the License, or (at your
13 # option) any later version.
13 # option) any later version.
14 #
14 #
15
15
16 local curcontext="$curcontext" state line
16 local curcontext="$curcontext" state line
17 typeset -A _hg_cmd_globals
17 typeset -A _hg_cmd_globals
18
18
19 _hg() {
19 _hg() {
20 local cmd
20 local cmd
21 integer i=2
21 integer i=2
22 _hg_cmd_globals=()
22 _hg_cmd_globals=()
23
23
24 while (( i < $#words ))
24 while (( i < $#words ))
25 do
25 do
26 case "$words[$i]" in
26 case "$words[$i]" in
27 -R|--repository|--cwd|--config)
27 -R|--repository|--cwd|--config)
28 # pass along arguments to hg completer
28 # pass along arguments to hg completer
29 _hg_cmd_globals+="$words[$i]"
29 _hg_cmd_globals+="$words[$i]"
30 _hg_cmd_globals+="$words[$i+1]"
30 _hg_cmd_globals+="$words[$i+1]"
31 (( i += 2 ))
31 (( i += 2 ))
32 continue
32 continue
33 ;;
33 ;;
34 -R*)
34 -R*)
35 _hg_cmd_globals+="$words[$i]"
35 _hg_cmd_globals+="$words[$i]"
36 (( i++ ))
36 (( i++ ))
37 continue
37 continue
38 ;;
38 ;;
39 -*)
39 -*)
40 # skip option
40 # skip option
41 (( i++ ))
41 (( i++ ))
42 continue
42 continue
43 ;;
43 ;;
44 esac
44 esac
45 if [[ -z "$cmd" ]]
45 if [[ -z "$cmd" ]]
46 then
46 then
47 cmd="$words[$i]"
47 cmd="$words[$i]"
48 words[$i]=()
48 words[$i]=()
49 (( CURRENT-- ))
49 (( CURRENT-- ))
50 fi
50 fi
51 (( i++ ))
51 (( i++ ))
52 done
52 done
53
53
54 if [[ -z "$cmd" ]]
54 if [[ -z "$cmd" ]]
55 then
55 then
56 _arguments -s -w : $_hg_global_opts \
56 _arguments -s -w : $_hg_global_opts \
57 ':mercurial command:_hg_commands'
57 ':mercurial command:_hg_commands'
58 return
58 return
59 fi
59 fi
60
60
61 # resolve abbreviations and aliases
61 # resolve abbreviations and aliases
62 if ! (( $+functions[_hg_cmd_${cmd}] ))
62 if ! (( $+functions[_hg_cmd_${cmd}] ))
63 then
63 then
64 local cmdexp
64 local cmdexp
65 (( $#_hg_cmd_list )) || _hg_get_commands
65 (( $#_hg_cmd_list )) || _hg_get_commands
66
66
67 cmdexp=$_hg_cmd_list[(r)${cmd}*]
67 cmdexp=$_hg_cmd_list[(r)${cmd}*]
68 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
68 if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
69 then
69 then
70 # might be nice to rewrite the command line with the expansion
70 # might be nice to rewrite the command line with the expansion
71 cmd="$cmdexp"
71 cmd="$cmdexp"
72 fi
72 fi
73 if [[ -n $_hg_alias_list[$cmd] ]]
73 if [[ -n $_hg_alias_list[$cmd] ]]
74 then
74 then
75 cmd=$_hg_alias_list[$cmd]
75 cmd=$_hg_alias_list[$cmd]
76 fi
76 fi
77 fi
77 fi
78
78
79 if (( $+functions[_hg_cmd_${cmd}] ))
79 if (( $+functions[_hg_cmd_${cmd}] ))
80 then
80 then
81 curcontext="${curcontext%:*:*}:hg-${cmd}:"
81 curcontext="${curcontext%:*:*}:hg-${cmd}:"
82 _hg_cmd_${cmd}
82 _hg_cmd_${cmd}
83 return
83 return
84 fi
84 fi
85 }
85 }
86
86
87 _hg_get_commands() {
87 _hg_get_commands() {
88 typeset -ga _hg_cmd_list
88 typeset -ga _hg_cmd_list
89 typeset -gA _hg_alias_list
89 typeset -gA _hg_alias_list
90 local hline cmd cmdalias
90 local hline cmd cmdalias
91 _call_program help hg --verbose help | while read -A hline
91 _call_program help hg --verbose help | while read -A hline
92 do
92 do
93 cmd="$hline[1]"
93 cmd="$hline[1]"
94 case $cmd in
94 case $cmd in
95 *:)
95 *:)
96 cmd=${cmd%:}
96 cmd=${cmd%:}
97 _hg_cmd_list+=($cmd)
97 _hg_cmd_list+=($cmd)
98 ;;
98 ;;
99 *,)
99 *,)
100 cmd=${cmd%,}
100 cmd=${cmd%,}
101 _hg_cmd_list+=($cmd)
101 _hg_cmd_list+=($cmd)
102 integer i=2
102 integer i=2
103 while (( i <= $#hline ))
103 while (( i <= $#hline ))
104 do
104 do
105 cmdalias=${hline[$i]%(:|,)}
105 cmdalias=${hline[$i]%(:|,)}
106 _hg_cmd_list+=($cmdalias)
106 _hg_cmd_list+=($cmdalias)
107 _hg_alias_list+=($cmdalias $cmd)
107 _hg_alias_list+=($cmdalias $cmd)
108 (( i++ ))
108 (( i++ ))
109 done
109 done
110 ;;
110 ;;
111 esac
111 esac
112 done
112 done
113 }
113 }
114
114
115 _hg_commands() {
115 _hg_commands() {
116 (( $#_hg_cmd_list )) || _hg_get_commands
116 (( $#_hg_cmd_list )) || _hg_get_commands
117 _describe -t commands 'mercurial command' _hg_cmd_list
117 _describe -t commands 'mercurial command' _hg_cmd_list
118 }
118 }
119
119
120 _hg_revrange() {
121 compset -P 1 '*:'
122 _hg_tags "$@"
123 }
124
120 _hg_tags() {
125 _hg_tags() {
121 typeset -a tags
126 typeset -a tags
122 local tag rev
127 local tag rev
123
128
124 _hg_cmd tags 2> /dev/null | while read tag rev
129 _hg_cmd tags 2> /dev/null | while read tag rev
125 do
130 do
126 tags+=($tag)
131 tags+=($tag)
127 done
132 done
128 (( $#tags )) && _describe -t tags 'tags' tags
133 (( $#tags )) && _describe -t tags 'tags' tags
129 }
134 }
130
135
131 _hg_status() {
136 _hg_status() {
132 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"})
137 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"})
133 }
138 }
134
139
135 _hg_unknown() {
140 _hg_unknown() {
136 typeset -a status_files
141 typeset -a status_files
137 _hg_status u
142 _hg_status u
138 (( $#status_files )) && _describe -t files 'unknown files' status_files
143 (( $#status_files )) && _describe -t files 'unknown files' status_files
139 }
144 }
140
145
141 _hg_missing() {
146 _hg_missing() {
142 typeset -a status_files
147 typeset -a status_files
143 _hg_status d
148 _hg_status d
144 (( $#status_files )) && _describe -t files 'missing files' status_files
149 (( $#status_files )) && _describe -t files 'missing files' status_files
145 }
150 }
146
151
147 _hg_addremove() {
152 _hg_addremove() {
148 _alternative 'files:unknown files:_hg_unknown' \
153 _alternative 'files:unknown files:_hg_unknown' \
149 'files:missing files:_hg_missing'
154 'files:missing files:_hg_missing'
150 }
155 }
151
156
152 _hg_paths() {
157 _hg_paths() {
153 typeset -a paths pnames
158 typeset -a paths pnames
154 _hg_cmd paths 2> /dev/null | while read -A pnames
159 _hg_cmd paths 2> /dev/null | while read -A pnames
155 do
160 do
156 paths+=($pnames[1])
161 paths+=($pnames[1])
157 done
162 done
158 (( $#paths )) && _describe -t urls 'repository aliases' paths
163 (( $#paths )) && _describe -t urls 'repository aliases' paths
159 }
164 }
160
165
161 _hg_remote() {
166 _hg_remote() {
162 _alternative 'urls:repository alias:_hg_paths' \
167 _alternative 'urls:repository alias:_hg_paths' \
163 'directories:directory:_files -/'
168 'directories:directory:_files -/'
164 }
169 }
165
170
166 # Common options
171 # Common options
167 _hg_global_opts=(
172 _hg_global_opts=(
168 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
173 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
169 '--cwd[change working directory]:new working directory:_files -/'
174 '--cwd[change working directory]:new working directory:_files -/'
170 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
175 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
171 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
176 '(--verbose -v)'{-v,--verbose}'[enable additional output]'
172 '(--quiet -q)'{-q,--quiet}'[suppress output]'
177 '(--quiet -q)'{-q,--quiet}'[suppress output]'
173 '(--help -h)'{-h,--help}'[display help and exit]'
178 '(--help -h)'{-h,--help}'[display help and exit]'
174 '--debug[debug mode]'
179 '--debug[debug mode]'
175 '--debugger[start debugger]'
180 '--debugger[start debugger]'
176 '--traceback[print traceback on exception]'
181 '--traceback[print traceback on exception]'
177 '--time[time how long the command takes]'
182 '--time[time how long the command takes]'
178 '--profile[profile]'
183 '--profile[profile]'
179 '--version[output version information and exit]'
184 '--version[output version information and exit]'
180 )
185 )
181
186
182 _hg_pat_opts=(
187 _hg_pat_opts=(
183 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
188 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
184 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
189 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
185
190
186 _hg_diff_opts=(
191 _hg_diff_opts=(
187 '(--text -a)'{-a,--text}'[treat all files as text]'
192 '(--text -a)'{-a,--text}'[treat all files as text]'
188 '(--git -g)'{-g,--git}'[use git extended diff format]'
193 '(--git -g)'{-g,--git}'[use git extended diff format]'
189 "--nodates[don't include dates in diff headers]")
194 "--nodates[don't include dates in diff headers]")
190
195
191 _hg_dryrun_opts=(
196 _hg_dryrun_opts=(
192 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
197 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
193
198
194 _hg_style_opts=(
199 _hg_style_opts=(
195 '--style[display using template map file]:'
200 '--style[display using template map file]:'
196 '--template[display with template]:')
201 '--template[display with template]:')
197
202
198 _hg_commit_opts=(
203 _hg_commit_opts=(
199 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
204 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
200 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
205 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
201 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
206 '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
202
207
203 _hg_remote_opts=(
208 _hg_remote_opts=(
204 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
209 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
205 '--remotecmd[specify hg command to run on the remote side]:')
210 '--remotecmd[specify hg command to run on the remote side]:')
206
211
207 _hg_cmd() {
212 _hg_cmd() {
208 _call_program hg hg "$_hg_cmd_globals[@]" "$@"
213 _call_program hg hg "$_hg_cmd_globals[@]" "$@"
209 }
214 }
210
215
211 _hg_cmd_add() {
216 _hg_cmd_add() {
212 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
217 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
213 '*:unknown files:_hg_unknown'
218 '*:unknown files:_hg_unknown'
214 }
219 }
215
220
216 _hg_cmd_addremove() {
221 _hg_cmd_addremove() {
217 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
222 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
218 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
223 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
219 '*:unknown or missing files:_hg_addremove'
224 '*:unknown or missing files:_hg_addremove'
220 }
225 }
221
226
222 _hg_cmd_annotate() {
227 _hg_cmd_annotate() {
223 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
228 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
224 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
229 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
225 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
230 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
226 '(--text -a)'{-a,--text}'[treat all files as text]' \
231 '(--text -a)'{-a,--text}'[treat all files as text]' \
227 '(--user -u)'{-u,--user}'[list the author]' \
232 '(--user -u)'{-u,--user}'[list the author]' \
228 '(--date -d)'{-d,--date}'[list the date]' \
233 '(--date -d)'{-d,--date}'[list the date]' \
229 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
234 '(--number -n)'{-n,--number}'[list the revision number (default)]' \
230 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
235 '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
231 '*:files:_files -W $(_hg_cmd root)'
236 '*:files:_files -W $(_hg_cmd root)'
232 }
237 }
233
238
234 _hg_cmd_archive() {
239 _hg_cmd_archive() {
235 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
240 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
236 '--no-decode[do not pass files through decoders]' \
241 '--no-decode[do not pass files through decoders]' \
237 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
242 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
238 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
243 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
239 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
244 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
240 '*:destination:_files'
245 '*:destination:_files'
241 }
246 }
242
247
243 _hg_cmd_bundle() {
248 _hg_cmd_bundle() {
244 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
249 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
245 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
250 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
246 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
251 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
247 ':output file:_files' \
252 ':output file:_files' \
248 ':destination repository:_files -/'
253 ':destination repository:_files -/'
249 }
254 }
250
255
251 _hg_cmd_cat() {
256 _hg_cmd_cat() {
252 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
257 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
253 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
258 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
254 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
259 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
255 '*:file:_files -W $(_hg_cmd root)'
260 '*:file:_files -W $(_hg_cmd root)'
256 }
261 }
257
262
258 _hg_cmd_clone() {
263 _hg_cmd_clone() {
259 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
264 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
260 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
265 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
261 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
266 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
262 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
267 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
263 ':source repository:_hg_remote' \
268 ':source repository:_hg_remote' \
264 ':destination:_files -/'
269 ':destination:_files -/'
265 }
270 }
266
271
267 _hg_cmd_commit() {
272 _hg_cmd_commit() {
268 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
273 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
269 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]'
274 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]'
270 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
275 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
271 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \
276 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \
272 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
277 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
273 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
278 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
274 '*:file:_files -W $(_hg_cmd root)'
279 '*:file:_files -W $(_hg_cmd root)'
275 }
280 }
276
281
277 _hg_cmd_copy() {
282 _hg_cmd_copy() {
278 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
283 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
279 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
284 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
280 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
285 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
281 '*:file:_files -W $(_hg_cmd root)'
286 '*:file:_files -W $(_hg_cmd root)'
282 }
287 }
283
288
284 _hg_cmd_diff() {
289 _hg_cmd_diff() {
285 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
290 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
286 '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \
291 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
287 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
292 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
288 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
293 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
289 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
294 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
290 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
295 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
291 '*:file:_files -W $(_hg_cmd root)'
296 '*:file:_files -W $(_hg_cmd root)'
292 }
297 }
293
298
294 _hg_cmd_export() {
299 _hg_cmd_export() {
295 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
300 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
296 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
301 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
297 '--switch-parent[diff against the second parent]' \
302 '--switch-parent[diff against the second parent]' \
298 '*:revision:_hg_tags'
303 '*:revision:_hg_tags'
299 }
304 }
300
305
301 _hg_cmd_grep() {
306 _hg_cmd_grep() {
302 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
307 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
303 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
308 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
304 '--all[print all revisions with matches]' \
309 '--all[print all revisions with matches]' \
305 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
310 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
306 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
311 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
307 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
312 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
308 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
313 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
309 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \
314 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
310 '(--user -u)'{-u,--user}'[print user who committed change]' \
315 '(--user -u)'{-u,--user}'[print user who committed change]' \
311 '*:search pattern:_files -W $(_hg_cmd root)'
316 '*:search pattern:_files -W $(_hg_cmd root)'
312 }
317 }
313
318
314 _hg_cmd_heads() {
319 _hg_cmd_heads() {
315 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
320 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
316 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
321 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
317 }
322 }
318
323
319 _hg_cmd_help() {
324 _hg_cmd_help() {
320 _arguments -s -w : $_hg_global_opts \
325 _arguments -s -w : $_hg_global_opts \
321 '*:mercurial command:_hg_commands'
326 '*:mercurial command:_hg_commands'
322 }
327 }
323
328
324 _hg_cmd_import() {
329 _hg_cmd_import() {
325 _arguments -s -w : $_hg_global_opts \
330 _arguments -s -w : $_hg_global_opts \
326 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
331 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
327 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
332 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
328 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
333 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
329 '*:patch:_files'
334 '*:patch:_files'
330 }
335 }
331
336
332 _hg_cmd_incoming() {
337 _hg_cmd_incoming() {
333 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
338 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
334 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
339 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
335 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
340 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
336 '(--patch -p)'{-p,--patch}'[show patch]' \
341 '(--patch -p)'{-p,--patch}'[show patch]' \
337 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \
342 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \
338 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
343 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
339 '--bundle[file to store the bundles into]:bundle file:_files' \
344 '--bundle[file to store the bundles into]:bundle file:_files' \
340 ':source:_hg_remote'
345 ':source:_hg_remote'
341 }
346 }
342
347
343 _hg_cmd_init() {
348 _hg_cmd_init() {
344 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
349 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
345 ':dir:_files -/'
350 ':dir:_files -/'
346 }
351 }
347
352
348 _hg_cmd_locate() {
353 _hg_cmd_locate() {
349 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
354 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
350 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
355 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
351 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
356 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
352 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
357 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
353 '*:search pattern:_files -W $(_hg_cmd root)'
358 '*:search pattern:_files -W $(_hg_cmd root)'
354 }
359 }
355
360
356 _hg_cmd_log() {
361 _hg_cmd_log() {
357 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
362 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
358 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
363 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
359 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
364 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
360 '(--copies -C)'{-C,--copies}'[show copied files]' \
365 '(--copies -C)'{-C,--copies}'[show copied files]' \
361 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
366 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
362 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
367 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
363 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \
368 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
364 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
369 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
365 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
370 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
366 '(--patch -p)'{-p,--patch}'[show patch]' \
371 '(--patch -p)'{-p,--patch}'[show patch]' \
367 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
372 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
368 '*:files:_files -W $(_hg_cmd root)'
373 '*:files:_files -W $(_hg_cmd root)'
369 }
374 }
370
375
371 _hg_cmd_manifest() {
376 _hg_cmd_manifest() {
372 _arguments -s -w : $_hg_global_opts \
377 _arguments -s -w : $_hg_global_opts \
373 ':revision:_hg_tags'
378 ':revision:_hg_tags'
374 }
379 }
375
380
376 _hg_cmd_outgoing() {
381 _hg_cmd_outgoing() {
377 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
382 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
378 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
383 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
379 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
384 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
380 '(--patch -p)'{-p,--patch}'[show patch]' \
385 '(--patch -p)'{-p,--patch}'[show patch]' \
381 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
386 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
382 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
387 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
383 ':destination:_hg_remote'
388 ':destination:_hg_remote'
384 }
389 }
385
390
386 _hg_cmd_parents() {
391 _hg_cmd_parents() {
387 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
392 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
388 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
393 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
389 ':revision:_hg_tags'
394 ':revision:_hg_tags'
390 }
395 }
391
396
392 _hg_cmd_paths() {
397 _hg_cmd_paths() {
393 _arguments -s -w : $_hg_global_opts \
398 _arguments -s -w : $_hg_global_opts \
394 ':path:_hg_paths'
399 ':path:_hg_paths'
395 }
400 }
396
401
397 _hg_cmd_pull() {
402 _hg_cmd_pull() {
398 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
403 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
399 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
404 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
400 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
405 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
401 ':source:_hg_remote'
406 ':source:_hg_remote'
402 }
407 }
403
408
404 _hg_cmd_push() {
409 _hg_cmd_push() {
405 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
410 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
406 '(--force -f)'{-f,--force}'[force push]' \
411 '(--force -f)'{-f,--force}'[force push]' \
407 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
412 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
408 ':destination:_hg_remote'
413 ':destination:_hg_remote'
409 }
414 }
410
415
411 _hg_cmd_remove() {
416 _hg_cmd_remove() {
412 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
417 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
413 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
418 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
414 '(--force -f)'{-f,--force}'[remove file even if modified]' \
419 '(--force -f)'{-f,--force}'[remove file even if modified]' \
415 '*:file:_files -W $(_hg_cmd root)'
420 '*:file:_files -W $(_hg_cmd root)'
416 }
421 }
417
422
418 _hg_cmd_rename() {
423 _hg_cmd_rename() {
419 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
424 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
420 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
425 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
421 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
426 '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
422 '*:file:_files -W $(_hg_cmd root)'
427 '*:file:_files -W $(_hg_cmd root)'
423 }
428 }
424
429
425 _hg_cmd_revert() {
430 _hg_cmd_revert() {
426 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
431 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
427 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
432 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
428 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
433 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
429 '--no-backup[do not save backup copies of files]' \
434 '--no-backup[do not save backup copies of files]' \
430 '*:file:_files -W $(_hg_cmd root)'
435 '*:file:_files -W $(_hg_cmd root)'
431 }
436 }
432
437
433 _hg_cmd_serve() {
438 _hg_cmd_serve() {
434 _arguments -s -w : $_hg_global_opts \
439 _arguments -s -w : $_hg_global_opts \
435 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
440 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
436 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
441 '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
437 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
442 '(--daemon -d)'{-d,--daemon}'[run server in background]' \
438 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
443 '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
439 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
444 '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
440 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
445 '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
441 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
446 '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
442 '--style[web template style]:style' \
447 '--style[web template style]:style' \
443 '--stdio[for remote clients]' \
448 '--stdio[for remote clients]' \
444 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
449 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
445 }
450 }
446
451
447 _hg_cmd_status() {
452 _hg_cmd_status() {
448 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
453 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
449 '(--all -A)'{-A,--all}'[show status of all files]' \
454 '(--all -A)'{-A,--all}'[show status of all files]' \
450 '(--modified -m)'{-m,--modified}'[show only modified files]' \
455 '(--modified -m)'{-m,--modified}'[show only modified files]' \
451 '(--added -a)'{-a,--added}'[show only added files]' \
456 '(--added -a)'{-a,--added}'[show only added files]' \
452 '(--removed -r)'{-r,--removed}'[show only removed files]' \
457 '(--removed -r)'{-r,--removed}'[show only removed files]' \
453 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
458 '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
454 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
459 '(--clean -c)'{-c,--clean}'[show only files without changes]' \
455 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
460 '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
456 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
461 '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
457 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
462 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
458 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
463 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
459 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
464 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
460 '--rev[show difference from revision]:revision:_hg_tags' \
465 '--rev[show difference from revision]:revision:_hg_tags' \
461 '*:files:_files'
466 '*:files:_files'
462 }
467 }
463
468
464 _hg_cmd_tag() {
469 _hg_cmd_tag() {
465 _arguments -s -w : $_hg_global_opts \
470 _arguments -s -w : $_hg_global_opts \
466 '(--local -l)'{-l,--local}'[make the tag local]' \
471 '(--local -l)'{-l,--local}'[make the tag local]' \
467 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
472 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
468 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
473 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
469 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
474 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
470 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
475 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
471 ':tag name:'
476 ':tag name:'
472 }
477 }
473
478
474 _hg_cmd_tip() {
479 _hg_cmd_tip() {
475 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
480 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
476 '(--patch -p)'{-p,--patch}'[show patch]'
481 '(--patch -p)'{-p,--patch}'[show patch]'
477 }
482 }
478
483
479 _hg_cmd_unbundle() {
484 _hg_cmd_unbundle() {
480 _arguments -s -w : $_hg_global_opts \
485 _arguments -s -w : $_hg_global_opts \
481 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
486 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
482 ':files:_files'
487 ':files:_files'
483 }
488 }
484
489
485 _hg_cmd_update() {
490 _hg_cmd_update() {
486 _arguments -s -w : $_hg_global_opts \
491 _arguments -s -w : $_hg_global_opts \
487 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
492 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
488 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
493 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
489 ':revision:_hg_tags'
494 ':revision:_hg_tags'
490 }
495 }
491
496
492 # HGK
497 # HGK
493 _hg_cmd_view() {
498 _hg_cmd_view() {
494 _arguments -s -w : $_hg_global_opts \
499 _arguments -s -w : $_hg_global_opts \
495 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
500 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
496 ':revision range:_hg_tags'
501 ':revision range:_hg_tags'
497 }
502 }
498
503
499 # MQ
504 # MQ
500 _hg_qseries() {
505 _hg_qseries() {
501 typeset -a patches
506 typeset -a patches
502 patches=($(_hg_cmd qseries))
507 patches=($(_hg_cmd qseries))
503 (( $#patches )) && _describe -t hg-patches 'patches' patches
508 (( $#patches )) && _describe -t hg-patches 'patches' patches
504 }
509 }
505
510
506 _hg_qapplied() {
511 _hg_qapplied() {
507 typeset -a patches
512 typeset -a patches
508 patches=($(_hg_cmd qapplied))
513 patches=($(_hg_cmd qapplied))
509 if (( $#patches ))
514 if (( $#patches ))
510 then
515 then
511 patches+=(qbase qtip)
516 patches+=(qbase qtip)
512 _describe -t hg-applied-patches 'applied patches' patches
517 _describe -t hg-applied-patches 'applied patches' patches
513 fi
518 fi
514 }
519 }
515
520
516 _hg_qunapplied() {
521 _hg_qunapplied() {
517 typeset -a patches
522 typeset -a patches
518 patches=($(_hg_cmd qunapplied))
523 patches=($(_hg_cmd qunapplied))
519 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
524 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
520 }
525 }
521
526
522 _hg_qguards() {
527 _hg_qguards() {
523 typeset -a guards
528 typeset -a guards
524 local guard
529 local guard
525 compset -P "+|-"
530 compset -P "+|-"
526 _hg_cmd qselect -s | while read guard
531 _hg_cmd qselect -s | while read guard
527 do
532 do
528 guards+=(${guard#(+|-)})
533 guards+=(${guard#(+|-)})
529 done
534 done
530 (( $#guards )) && _describe -t hg-guards 'guards' guards
535 (( $#guards )) && _describe -t hg-guards 'guards' guards
531 }
536 }
532
537
533 _hg_qseries_opts=(
538 _hg_qseries_opts=(
534 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
539 '(--summary -s)'{-s,--summary}'[print first line of patch header]')
535
540
536 _hg_cmd_qapplied() {
541 _hg_cmd_qapplied() {
537 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
542 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
538 }
543 }
539
544
540 _hg_cmd_qdelete() {
545 _hg_cmd_qdelete() {
541 _arguments -s -w : $_hg_global_opts \
546 _arguments -s -w : $_hg_global_opts \
542 '(--keep -k)'{-k,--keep}'[keep patch file]' \
547 '(--keep -k)'{-k,--keep}'[keep patch file]' \
543 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \
548 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
544 '*:unapplied patch:_hg_qunapplied'
549 '*:unapplied patch:_hg_qunapplied'
545 }
550 }
546
551
547 _hg_cmd_qdiff() {
552 _hg_cmd_qdiff() {
548 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
553 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
549 '*:pattern:_files -W $(_hg_cmd root)'
554 '*:pattern:_files -W $(_hg_cmd root)'
550 }
555 }
551
556
552 _hg_cmd_qfold() {
557 _hg_cmd_qfold() {
553 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
558 _arguments -s -w : $_hg_global_opts $_h_commit_opts \
554 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
559 '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
555 '*:unapplied patch:_hg_qunapplied'
560 '*:unapplied patch:_hg_qunapplied'
556 }
561 }
557
562
558 _hg_cmd_qguard() {
563 _hg_cmd_qguard() {
559 _arguments -s -w : $_hg_global_opts \
564 _arguments -s -w : $_hg_global_opts \
560 '(--list -l)'{-l,--list}'[list all patches and guards]' \
565 '(--list -l)'{-l,--list}'[list all patches and guards]' \
561 '(--none -n)'{-n,--none}'[drop all guards]' \
566 '(--none -n)'{-n,--none}'[drop all guards]' \
562 ':patch:_hg_qseries' \
567 ':patch:_hg_qseries' \
563 '*:guards:_hg_qguards'
568 '*:guards:_hg_qguards'
564 }
569 }
565
570
566 _hg_cmd_qheader() {
571 _hg_cmd_qheader() {
567 _arguments -s -w : $_hg_global_opts \
572 _arguments -s -w : $_hg_global_opts \
568 ':patch:_hg_qseries'
573 ':patch:_hg_qseries'
569 }
574 }
570
575
571 _hg_cmd_qimport() {
576 _hg_cmd_qimport() {
572 _arguments -s -w : $_hg_global_opts \
577 _arguments -s -w : $_hg_global_opts \
573 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
578 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
574 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
579 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
575 '(--force -f)'{-f,--force}'[overwrite existing files]' \
580 '(--force -f)'{-f,--force}'[overwrite existing files]' \
576 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \
581 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
577 '*:patch:_files'
582 '*:patch:_files'
578 }
583 }
579
584
580 _hg_cmd_qnew() {
585 _hg_cmd_qnew() {
581 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
586 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
582 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
587 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
583 ':patch:'
588 ':patch:'
584 }
589 }
585
590
586 _hg_cmd_qnext() {
591 _hg_cmd_qnext() {
587 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
592 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
588 }
593 }
589
594
590 _hg_cmd_qpop() {
595 _hg_cmd_qpop() {
591 _arguments -s -w : $_hg_global_opts \
596 _arguments -s -w : $_hg_global_opts \
592 '(--all -a :)'{-a,--all}'[pop all patches]' \
597 '(--all -a :)'{-a,--all}'[pop all patches]' \
593 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
598 '(--name -n)'{-n+,--name}'[queue name to pop]:' \
594 '(--force -f)'{-f,--force}'[forget any local changes]' \
599 '(--force -f)'{-f,--force}'[forget any local changes]' \
595 ':patch:_hg_qapplied'
600 ':patch:_hg_qapplied'
596 }
601 }
597
602
598 _hg_cmd_qprev() {
603 _hg_cmd_qprev() {
599 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
604 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
600 }
605 }
601
606
602 _hg_cmd_qpush() {
607 _hg_cmd_qpush() {
603 _arguments -s -w : $_hg_global_opts \
608 _arguments -s -w : $_hg_global_opts \
604 '(--all -a :)'{-a,--all}'[apply all patches]' \
609 '(--all -a :)'{-a,--all}'[apply all patches]' \
605 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
610 '(--list -l)'{-l,--list}'[list patch name in commit text]' \
606 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
611 '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
607 '(--name -n)'{-n+,--name}'[merge queue name]:' \
612 '(--name -n)'{-n+,--name}'[merge queue name]:' \
608 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
613 '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
609 ':patch:_hg_qunapplied'
614 ':patch:_hg_qunapplied'
610 }
615 }
611
616
612 _hg_cmd_qrefresh() {
617 _hg_cmd_qrefresh() {
613 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
618 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
614 '(--git -g)'{-g,--git}'[use git extended diff format]' \
619 '(--git -g)'{-g,--git}'[use git extended diff format]' \
615 '(--short -s)'{-s,--short}'[short refresh]' \
620 '(--short -s)'{-s,--short}'[short refresh]' \
616 '*:files:_files -W $(_hg_cmd root)'
621 '*:files:_files -W $(_hg_cmd root)'
617 }
622 }
618
623
619 _hg_cmd_qrename() {
624 _hg_cmd_qrename() {
620 _arguments -s -w : $_hg_global_opts \
625 _arguments -s -w : $_hg_global_opts \
621 ':patch:_hg_qseries' \
626 ':patch:_hg_qseries' \
622 ':destination:'
627 ':destination:'
623 }
628 }
624
629
625 _hg_cmd_qselect() {
630 _hg_cmd_qselect() {
626 _arguments -s -w : $_hg_global_opts \
631 _arguments -s -w : $_hg_global_opts \
627 '(--none -n :)'{-n,--none}'[disable all guards]' \
632 '(--none -n :)'{-n,--none}'[disable all guards]' \
628 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
633 '(--series -s :)'{-s,--series}'[list all guards in series file]' \
629 '--pop[pop to before first guarded applied patch]' \
634 '--pop[pop to before first guarded applied patch]' \
630 '--reapply[pop and reapply patches]' \
635 '--reapply[pop and reapply patches]' \
631 '*:guards:_hg_qguards'
636 '*:guards:_hg_qguards'
632 }
637 }
633
638
634 _hg_cmd_qseries() {
639 _hg_cmd_qseries() {
635 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
640 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
636 '(--missing -m)'{-m,--missing}'[print patches not in series]'
641 '(--missing -m)'{-m,--missing}'[print patches not in series]'
637 }
642 }
638
643
639 _hg_cmd_qunapplied() {
644 _hg_cmd_qunapplied() {
640 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
645 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
641 }
646 }
642
647
643 _hg_cmd_qtop() {
648 _hg_cmd_qtop() {
644 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
649 _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
645 }
650 }
646
651
647 _hg_cmd_strip() {
652 _hg_cmd_strip() {
648 _arguments -s -w : $_hg_global_opts \
653 _arguments -s -w : $_hg_global_opts \
649 '(--force -f)'{-f,--force}'[force multi-head removal]' \
654 '(--force -f)'{-f,--force}'[force multi-head removal]' \
650 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
655 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
651 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
656 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
652 ':revision:_hg_tags'
657 ':revision:_hg_tags'
653 }
658 }
654
659
655 _hg "$@"
660 _hg "$@"
General Comments 0
You need to be logged in to leave comments. Login now