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