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