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