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