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