Show More
@@ -1,1270 +1,1262 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 -S : $_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 -S : $_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 HGPLAINEXCEPT=alias 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 | labels=("${(f)$(_hg_cmd debugnamecomplete)}") |
|
167 | 167 | (( $#labels )) && _describe -t labels 'labels' labels |
|
168 | 168 | } |
|
169 | 169 | |
|
170 | 170 | _hg_bookmarks() { |
|
171 | 171 | typeset -a bookmark bookmarks |
|
172 | 172 | |
|
173 | 173 | _hg_cmd bookmarks | while read -A bookmark |
|
174 | 174 | do |
|
175 | 175 | if test -z ${bookmark[-1]:#[0-9]*} |
|
176 | 176 | then |
|
177 | 177 | bookmarks+=($bookmark[-2]) |
|
178 | 178 | fi |
|
179 | 179 | done |
|
180 | 180 | (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks |
|
181 | 181 | } |
|
182 | 182 | |
|
183 | 183 | _hg_branches() { |
|
184 | 184 | typeset -a branches |
|
185 | 185 | local branch |
|
186 | 186 | |
|
187 | 187 | _hg_cmd branches | while read branch |
|
188 | 188 | do |
|
189 | 189 | branches+=(${branch/ #[0-9]#:*}) |
|
190 | 190 | done |
|
191 | 191 | (( $#branches )) && _describe -t branches 'branches' branches |
|
192 | 192 | } |
|
193 | 193 | |
|
194 | 194 | # likely merge candidates |
|
195 | 195 | _hg_mergerevs() { |
|
196 | typeset -a heads | |
|
197 | local myrev | |
|
196 | typeset -a heads branches | |
|
197 | local revset='sort(head() and not ., -rev)' | |
|
198 | 198 | |
|
199 |
heads=(${(f)"$(_hg_cmd |
|
|
200 | # exclude own revision | |
|
201 | myrev=$(_hg_cmd log -r . --template '{rev}:{branch}\\n') | |
|
202 | heads=(${heads:#$myrev}) | |
|
203 | ||
|
199 | heads=(${(f)"$(_hg_cmd log -r '$revset' --template '{rev}:{branch}\\n')"}) | |
|
204 | 200 | (( $#heads )) && _describe -t heads 'heads' heads |
|
205 | 201 | |
|
206 | branches=(${(f)"$(_hg_cmd heads --template '{branch}\\n')"}) | |
|
207 | # exclude own revision | |
|
208 | myrev=$(_hg_cmd log -r . --template '{branch}\\n') | |
|
209 | branches=(${branches:#$myrev}) | |
|
210 | ||
|
202 | branches=(${(S)heads/#*:/}) | |
|
211 | 203 | (( $#branches )) && _describe -t branches 'branches' branches |
|
212 | 204 | } |
|
213 | 205 | |
|
214 | 206 | _hg_files() { |
|
215 | 207 | if [[ -n "$_hg_root" ]] |
|
216 | 208 | then |
|
217 | 209 | [[ -d "$_hg_root/.hg" ]] || return |
|
218 | 210 | case "$_hg_root" in |
|
219 | 211 | /*) |
|
220 | 212 | _files -W $_hg_root |
|
221 | 213 | ;; |
|
222 | 214 | *) |
|
223 | 215 | _files -W $PWD/$_hg_root |
|
224 | 216 | ;; |
|
225 | 217 | esac |
|
226 | 218 | else |
|
227 | 219 | _files |
|
228 | 220 | fi |
|
229 | 221 | } |
|
230 | 222 | |
|
231 | 223 | _hg_status() { |
|
232 | 224 | [[ -d $PREFIX ]] || PREFIX=$PREFIX:h |
|
233 | 225 | status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"}) |
|
234 | 226 | } |
|
235 | 227 | |
|
236 | 228 | _hg_unknown() { |
|
237 | 229 | typeset -a status_files |
|
238 | 230 | _hg_status u |
|
239 | 231 | _wanted files expl 'unknown files' _multi_parts / status_files |
|
240 | 232 | } |
|
241 | 233 | |
|
242 | 234 | _hg_missing() { |
|
243 | 235 | typeset -a status_files |
|
244 | 236 | _hg_status d |
|
245 | 237 | _wanted files expl 'missing files' _multi_parts / status_files |
|
246 | 238 | } |
|
247 | 239 | |
|
248 | 240 | _hg_committable() { |
|
249 | 241 | typeset -a status_files |
|
250 | 242 | _hg_status mar |
|
251 | 243 | _wanted files expl 'modified, added or removed files' _multi_parts / status_files |
|
252 | 244 | } |
|
253 | 245 | |
|
254 | 246 | _hg_resolve() { |
|
255 | 247 | local rstate rpath |
|
256 | 248 | |
|
257 | 249 | [[ -d $PREFIX ]] || PREFIX=$PREFIX:h |
|
258 | 250 | |
|
259 | 251 | _hg_cmd resolve -l ./$PREFIX | while read rstate rpath |
|
260 | 252 | do |
|
261 | 253 | [[ $rstate == 'R' ]] && resolved_files+=($rpath) |
|
262 | 254 | [[ $rstate == 'U' ]] && unresolved_files+=($rpath) |
|
263 | 255 | done |
|
264 | 256 | } |
|
265 | 257 | |
|
266 | 258 | _hg_resolved() { |
|
267 | 259 | typeset -a resolved_files unresolved_files |
|
268 | 260 | _hg_resolve |
|
269 | 261 | _wanted files expl 'resolved files' _multi_parts / resolved_files |
|
270 | 262 | } |
|
271 | 263 | |
|
272 | 264 | _hg_unresolved() { |
|
273 | 265 | typeset -a resolved_files unresolved_files |
|
274 | 266 | _hg_resolve |
|
275 | 267 | _wanted files expl 'unresolved files' _multi_parts / unresolved_files |
|
276 | 268 | } |
|
277 | 269 | |
|
278 | 270 | _hg_config() { |
|
279 | 271 | typeset -a items |
|
280 | 272 | items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*}) |
|
281 | 273 | (( $#items )) && _describe -t config 'config item' items |
|
282 | 274 | } |
|
283 | 275 | |
|
284 | 276 | _hg_internal_merge_tools=( |
|
285 | 277 | \\:dump \\:fail \\:forcedump \\:local \\:merge \\:merge-local \\:merge-other |
|
286 | 278 | \\:merge3 \\:other \\:prompt \\:tagmerge \\:union |
|
287 | 279 | ) |
|
288 | 280 | |
|
289 | 281 | _hg_merge_tools() { |
|
290 | 282 | typeset -a external_tools |
|
291 | 283 | _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools |
|
292 | 284 | external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"}) |
|
293 | 285 | (( $#external_tools )) && _describe -t external_tools 'external merge tools' external_tools |
|
294 | 286 | } |
|
295 | 287 | |
|
296 | 288 | _hg_addremove() { |
|
297 | 289 | _alternative 'files:unknown files:_hg_unknown' \ |
|
298 | 290 | 'files:missing files:_hg_missing' |
|
299 | 291 | } |
|
300 | 292 | |
|
301 | 293 | _hg_ssh_urls() { |
|
302 | 294 | if [[ -prefix */ ]] |
|
303 | 295 | then |
|
304 | 296 | if zstyle -T ":completion:${curcontext}:files" remote-access |
|
305 | 297 | then |
|
306 | 298 | local host=${PREFIX%%/*} |
|
307 | 299 | typeset -a remdirs |
|
308 | 300 | compset -p $(( $#host + 1 )) |
|
309 | 301 | local rempath=${(M)PREFIX##*/} |
|
310 | 302 | local cacheid="hg:${host}-${rempath//\//_}" |
|
311 | 303 | cacheid=${cacheid%[-_]} |
|
312 | 304 | compset -P '*/' |
|
313 | 305 | if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" |
|
314 | 306 | then |
|
315 | 307 | remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/}) |
|
316 | 308 | _store_cache "$cacheid" remdirs |
|
317 | 309 | fi |
|
318 | 310 | _describe -t directories 'remote directory' remdirs -S/ |
|
319 | 311 | else |
|
320 | 312 | _message 'remote directory' |
|
321 | 313 | fi |
|
322 | 314 | else |
|
323 | 315 | if compset -P '*@' |
|
324 | 316 | then |
|
325 | 317 | _hosts -S/ |
|
326 | 318 | else |
|
327 | 319 | _alternative 'hosts:remote host name:_hosts -S/' \ |
|
328 | 320 | 'users:user:_users -S@' |
|
329 | 321 | fi |
|
330 | 322 | fi |
|
331 | 323 | } |
|
332 | 324 | |
|
333 | 325 | _hg_urls() { |
|
334 | 326 | if compset -P bundle:// |
|
335 | 327 | then |
|
336 | 328 | _files |
|
337 | 329 | elif compset -P ssh:// |
|
338 | 330 | then |
|
339 | 331 | _hg_ssh_urls |
|
340 | 332 | elif [[ -prefix *: ]] |
|
341 | 333 | then |
|
342 | 334 | _urls |
|
343 | 335 | else |
|
344 | 336 | local expl |
|
345 | 337 | compset -S '[^:]*' |
|
346 | 338 | _wanted url-schemas expl 'URL schema' compadd -S '' - \ |
|
347 | 339 | http:// https:// ssh:// bundle:// |
|
348 | 340 | fi |
|
349 | 341 | } |
|
350 | 342 | |
|
351 | 343 | _hg_paths() { |
|
352 | 344 | typeset -a paths pnames |
|
353 | 345 | _hg_cmd paths | while read -A pnames |
|
354 | 346 | do |
|
355 | 347 | paths+=($pnames[1]) |
|
356 | 348 | done |
|
357 | 349 | (( $#paths )) && _describe -t path-aliases 'repository alias' paths |
|
358 | 350 | } |
|
359 | 351 | |
|
360 | 352 | _hg_remote() { |
|
361 | 353 | _alternative 'path-aliases:repository alias:_hg_paths' \ |
|
362 | 354 | 'directories:directory:_files -/' \ |
|
363 | 355 | 'urls:URL:_hg_urls' |
|
364 | 356 | } |
|
365 | 357 | |
|
366 | 358 | _hg_clone_dest() { |
|
367 | 359 | _alternative 'directories:directory:_files -/' \ |
|
368 | 360 | 'urls:URL:_hg_urls' |
|
369 | 361 | } |
|
370 | 362 | |
|
371 | 363 | _hg_add_help_topics=( |
|
372 | 364 | config dates diffs environment extensions filesets glossary hgignore hgweb |
|
373 | 365 | merge-tools multirevs obsolescence patterns phases revisions revsets |
|
374 | 366 | subrepos templating urls |
|
375 | 367 | ) |
|
376 | 368 | |
|
377 | 369 | _hg_help_topics() { |
|
378 | 370 | local topics |
|
379 | 371 | (( $#_hg_cmd_list )) || _hg_get_commands |
|
380 | 372 | topics=($_hg_cmd_list $_hg_add_help_topics) |
|
381 | 373 | _describe -t help_topics 'help topics' topics |
|
382 | 374 | } |
|
383 | 375 | |
|
384 | 376 | # Common options |
|
385 | 377 | _hg_global_opts=( |
|
386 | 378 | '(--repository -R)'{-R+,--repository=}'[repository root directory or name of overlay bundle file]:repository:_files -/' |
|
387 | 379 | '--cwd=[change working directory]:new working directory:_files -/' |
|
388 | 380 | '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, automatically pick the first choice for all prompts]' |
|
389 | 381 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' |
|
390 | 382 | '*--config[set/override config option]:defined config items:_hg_config' |
|
391 | 383 | '(--quiet -q)'{-q,--quiet}'[suppress output]' |
|
392 | 384 | '(--help -h)'{-h,--help}'[display help and exit]' |
|
393 | 385 | '--debug[enable debugging output]' |
|
394 | 386 | '--debugger[start debugger]' |
|
395 | 387 | '--encoding=[set the charset encoding]:encoding' |
|
396 | 388 | '--encodingmode=[set the charset encoding mode]:encoding mode' |
|
397 | 389 | '--traceback[always print a traceback on exception]' |
|
398 | 390 | '--time[time how long the command takes]' |
|
399 | 391 | '--profile[print command execution profile]' |
|
400 | 392 | '--version[output version information and exit]' |
|
401 | 393 | '--hidden[consider hidden changesets]' |
|
402 | 394 | '--color=[when to colorize]:when:(true false yes no always auto never debug)' |
|
403 | 395 | '--pager=[when to paginate (default: auto)]:when:(true false yes no always auto never)' |
|
404 | 396 | ) |
|
405 | 397 | |
|
406 | 398 | _hg_pat_opts=( |
|
407 | 399 | '*'{-I+,--include=}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' |
|
408 | 400 | '*'{-X+,--exclude=}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') |
|
409 | 401 | |
|
410 | 402 | _hg_clone_opts=( |
|
411 | 403 | $_hg_remote_opts |
|
412 | 404 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' |
|
413 | 405 | '--pull[use pull protocol to copy metadata]' |
|
414 | 406 | '--uncompressed[use uncompressed transfer (fast over LAN)]') |
|
415 | 407 | |
|
416 | 408 | _hg_date_user_opts=( |
|
417 | 409 | '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]' |
|
418 | 410 | '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]' |
|
419 | 411 | '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' |
|
420 | 412 | '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user') |
|
421 | 413 | |
|
422 | 414 | _hg_gitlike_opts=( |
|
423 | 415 | '(--git -g)'{-g,--git}'[use git extended diff format]') |
|
424 | 416 | |
|
425 | 417 | _hg_diff_opts=( |
|
426 | 418 | $_hg_gitlike_opts |
|
427 | 419 | '(--text -a)'{-a,--text}'[treat all files as text]' |
|
428 | 420 | '--nodates[omit dates from diff headers]') |
|
429 | 421 | |
|
430 | 422 | _hg_mergetool_opts=( |
|
431 | 423 | '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool:_hg_merge_tools' |
|
432 | 424 | ) |
|
433 | 425 | |
|
434 | 426 | _hg_dryrun_opts=( |
|
435 | 427 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]') |
|
436 | 428 | |
|
437 | 429 | _hg_ignore_space_opts=( |
|
438 | 430 | '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' |
|
439 | 431 | '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' |
|
440 | 432 | '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' |
|
441 | 433 | '(--ignore-space-at-eol -Z)'{-Z,--ignore-space-at-eol}'[ignore changes in whitespace at EOL]' |
|
442 | 434 | ) |
|
443 | 435 | |
|
444 | 436 | _hg_template_opts=( |
|
445 | 437 | '--template[display with template]:template' |
|
446 | 438 | ) |
|
447 | 439 | |
|
448 | 440 | _hg_log_opts=( |
|
449 | 441 | $_hg_global_opts $_hg_template_opts $_hg_gitlike_opts |
|
450 | 442 | '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' |
|
451 | 443 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' |
|
452 | 444 | '(--patch -p)'{-p,--patch}'[show patch]' |
|
453 | 445 | '--stat[output diffstat-style summary of changes]' |
|
454 | 446 | '(--graph -G)'{-G,--graph}'[show the revision DAG]' |
|
455 | 447 | ) |
|
456 | 448 | |
|
457 | 449 | _hg_commit_opts=( |
|
458 | 450 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' |
|
459 | 451 | '(-e --edit -l --logfile --message -m)'{-m+,--message=}'[use <text> as commit message]:message' |
|
460 | 452 | '(-e --edit -m --message --logfile -l)'{-l+,--logfile=}'[read the commit message from <file>]:log file:_files') |
|
461 | 453 | |
|
462 | 454 | _hg_remote_opts=( |
|
463 | 455 | '(--ssh -e)'{-e+,--ssh=}'[specify ssh command to use]:command' |
|
464 | 456 | '--remotecmd=[specify hg command to run on the remote side]:remote command' |
|
465 | 457 | '--insecure[do not verify server certificate (ignoring web.cacerts config)]' |
|
466 | 458 | ) |
|
467 | 459 | |
|
468 | 460 | _hg_branch_bmark_opts=( |
|
469 | 461 | '(--bookmark -B)'{-B+,--bookmark=}'[specify bookmark(s)]:bookmark:_hg_bookmarks' |
|
470 | 462 | '(--branch -b)'{-b+,--branch=}'[specify branch(es)]:branch:_hg_branches' |
|
471 | 463 | ) |
|
472 | 464 | |
|
473 | 465 | _hg_subrepos_opts=( |
|
474 | 466 | '(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]') |
|
475 | 467 | |
|
476 | 468 | _hg_cmd() { |
|
477 | 469 | _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null |
|
478 | 470 | } |
|
479 | 471 | |
|
480 | 472 | _hg_cmd_add() { |
|
481 | 473 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \ |
|
482 | 474 | '*:unknown files:_hg_unknown' |
|
483 | 475 | } |
|
484 | 476 | |
|
485 | 477 | _hg_cmd_addremove() { |
|
486 | 478 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \ |
|
487 | 479 | '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \ |
|
488 | 480 | '*:unknown or missing files:_hg_addremove' |
|
489 | 481 | } |
|
490 | 482 | |
|
491 | 483 | _hg_cmd_annotate() { |
|
492 | 484 | _arguments -s -S : $_hg_global_opts $_hg_ignore_space_opts $_hg_pat_opts \ |
|
493 | 485 | '(--rev -r)'{-r+,--rev=}'[annotate the specified revision]:revision:_hg_labels' \ |
|
494 | 486 | "--no-follow[don't follow copies and renames]" \ |
|
495 | 487 | '(--text -a)'{-a,--text}'[treat all files as text]' \ |
|
496 | 488 | '(--user -u)'{-u,--user}'[list the author (long with -v)]' \ |
|
497 | 489 | '(--file -f)'{-f,--file}'[list the filename]' \ |
|
498 | 490 | '(--date -d)'{-d,--date}'[list the date (short with -q)]' \ |
|
499 | 491 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ |
|
500 | 492 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ |
|
501 | 493 | '(--line-number -l)'{-l,--line-number}'[show line number at the first appearance]' \ |
|
502 | 494 | '*:files:_hg_files' |
|
503 | 495 | } |
|
504 | 496 | |
|
505 | 497 | _hg_cmd_archive() { |
|
506 | 498 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ |
|
507 | 499 | '--no-decode[do not pass files through decoders]' \ |
|
508 | 500 | '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:prefix' \ |
|
509 | 501 | '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_labels' \ |
|
510 | 502 | '(--type -t)'{-t+,--type=}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ |
|
511 | 503 | '*:destination:_files' |
|
512 | 504 | } |
|
513 | 505 | |
|
514 | 506 | _hg_cmd_backout() { |
|
515 | 507 | _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \ |
|
516 | 508 | '--merge[merge with old dirstate parent after backout]' \ |
|
517 | 509 | '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ |
|
518 | 510 | '--parent[parent to choose when backing out merge]' \ |
|
519 | 511 | '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ |
|
520 | 512 | '(--rev -r 1)'{-r+,--rev=}'[revision to backout]:revision:_hg_labels' \ |
|
521 | 513 | '(--message -m)'{-m+,--message=}'[use <text> as commit message]:text' \ |
|
522 | 514 | '(--logfile -l)'{-l+,--logfile=}'[read commit message from <file>]:log file:_files' \ |
|
523 | 515 | ':revision:_hg_labels' |
|
524 | 516 | } |
|
525 | 517 | |
|
526 | 518 | _hg_cmd_bisect() { |
|
527 | 519 | _arguments -s -S : $_hg_global_opts \ |
|
528 | 520 | '(-)'{-r,--reset}'[reset bisect state]' \ |
|
529 | 521 | '(--extend -e)'{-e,--extend}'[extend the bisect range]' \ |
|
530 | 522 | '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \ |
|
531 | 523 | '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \ |
|
532 | 524 | '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \ |
|
533 | 525 | '(--command -c --noupdate -U)'{-c+,--command=}'[use command to check changeset state]':commands:_command_names \ |
|
534 | 526 | '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]' |
|
535 | 527 | } |
|
536 | 528 | |
|
537 | 529 | _hg_cmd_bookmarks() { |
|
538 | 530 | _arguments -s -S : $_hg_global_opts \ |
|
539 | 531 | '(--force -f)'{-f,--force}'[force]' \ |
|
540 | 532 | '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \ |
|
541 | 533 | '(--rev -r --delete -d --rename -m)'{-r+,--rev=}'[revision]:revision:_hg_labels' \ |
|
542 | 534 | '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \ |
|
543 | 535 | '(--rev -r --delete -d --rename -m)'{-m+,--rename=}'[rename a given bookmark]:bookmark:_hg_bookmarks' \ |
|
544 | 536 | ':bookmark:_hg_bookmarks' |
|
545 | 537 | } |
|
546 | 538 | |
|
547 | 539 | _hg_cmd_branch() { |
|
548 | 540 | _arguments -s -S : $_hg_global_opts \ |
|
549 | 541 | '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \ |
|
550 | 542 | '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]' |
|
551 | 543 | } |
|
552 | 544 | |
|
553 | 545 | _hg_cmd_branches() { |
|
554 | 546 | _arguments -s -S : $_hg_global_opts \ |
|
555 | 547 | '(--closed -c)'{-c,--closed}'[show normal and closed branches]' |
|
556 | 548 | } |
|
557 | 549 | |
|
558 | 550 | _hg_cmd_bundle() { |
|
559 | 551 | _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ |
|
560 | 552 | '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \ |
|
561 | 553 | '(2)*--base[a base changeset assumed to be available at the destination]:revision:_hg_labels' \ |
|
562 | 554 | '*'{-b+,--branch=}'[a specific branch you would like to bundle]:branch:_hg_branches' \ |
|
563 | 555 | '*'{-r+,--rev=}'[a changeset intended to be added to the destination]:revision:_hg_labels' \ |
|
564 | 556 | '--all[bundle all changesets in the repository]' \ |
|
565 | 557 | '--type[bundle compression type to use (default: bzip2)]:bundle type' \ |
|
566 | 558 | ':output file:_files' \ |
|
567 | 559 | ':destination repository:_files -/' |
|
568 | 560 | } |
|
569 | 561 | |
|
570 | 562 | _hg_cmd_cat() { |
|
571 | 563 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ |
|
572 | 564 | '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \ |
|
573 | 565 | '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_labels' \ |
|
574 | 566 | '--decode[apply any matching decode filter]' \ |
|
575 | 567 | '*:file:_hg_files' |
|
576 | 568 | } |
|
577 | 569 | |
|
578 | 570 | _hg_cmd_clone() { |
|
579 | 571 | _arguments -s -S : $_hg_global_opts $_hg_clone_opts \ |
|
580 | 572 | '*'{-r+,--rev=}'[do not clone everything, but include this changeset and its ancestors]:revision' \ |
|
581 | 573 | '(--updaterev -u)'{-u+,--updaterev=}'[revision, tag or branch to check out]:revision' \ |
|
582 | 574 | '*'{-b+,--branch=}"[do not clone everything, but include this branch's changesets and their ancestors]:branch" \ |
|
583 | 575 | ':source repository:_hg_remote' \ |
|
584 | 576 | ':destination:_hg_clone_dest' |
|
585 | 577 | } |
|
586 | 578 | |
|
587 | 579 | _hg_cmd_commit() { |
|
588 | 580 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ |
|
589 | 581 | '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ |
|
590 | 582 | '(--message -m)'{-m+,--message=}'[use <text> as commit message]:text' \ |
|
591 | 583 | '(--logfile -l)'{-l+,--logfile=}'[read commit message from <file>]:log file:_files' \ |
|
592 | 584 | '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ |
|
593 | 585 | '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ |
|
594 | 586 | '--amend[amend the parent of the working directory]' \ |
|
595 | 587 | '--close-branch[mark a branch head as closed]' \ |
|
596 | 588 | '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \ |
|
597 | 589 | '(--secret -s)'{-s,--secret}'[use the secret phase for committing]' \ |
|
598 | 590 | '*:file:_hg_committable' |
|
599 | 591 | } |
|
600 | 592 | |
|
601 | 593 | _hg_cmd_copy() { |
|
602 | 594 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
603 | 595 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ |
|
604 | 596 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
605 | 597 | '*:file:_hg_files' |
|
606 | 598 | } |
|
607 | 599 | |
|
608 | 600 | _hg_cmd_diff() { |
|
609 | 601 | local context state state_descr line ret=1 |
|
610 | 602 | typeset -A opt_args |
|
611 | 603 | |
|
612 | 604 | _arguments -s -S : $_hg_global_opts $_hg_diff_opts $_hg_ignore_space_opts \ |
|
613 | 605 | $_hg_pat_opts $_hg_subrepos_opts \ |
|
614 | 606 | '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \ |
|
615 | 607 | '--noprefix[omit a/ and b/ prefixes from filenames]' \ |
|
616 | 608 | '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ |
|
617 | 609 | '(--change -c)'{-c+,--change=}'[change made by revision]:revision:_hg_labels' \ |
|
618 | 610 | '(--text -a)'{-a,--text}'[treat all files as text]' \ |
|
619 | 611 | '--reverse[produce a diff that undoes the changes]' \ |
|
620 | 612 | '(--unified -U)'{-U+,--unified=}'[number of lines of context to show]:count' \ |
|
621 | 613 | '--stat[output diffstat-style summary of changes]' \ |
|
622 | 614 | '--root=[produce diffs relative to subdirectory]:directory:_files -/' \ |
|
623 | 615 | '*:file:->diff_files' && ret=0 |
|
624 | 616 | |
|
625 | 617 | if [[ $state == 'diff_files' ]] |
|
626 | 618 | then |
|
627 | 619 | if [[ -n ${opt_args[(I)-r|--rev]} ]] |
|
628 | 620 | then |
|
629 | 621 | _hg_files && ret=0 |
|
630 | 622 | else |
|
631 | 623 | _hg_committable && ret=0 |
|
632 | 624 | fi |
|
633 | 625 | fi |
|
634 | 626 | |
|
635 | 627 | return ret |
|
636 | 628 | } |
|
637 | 629 | |
|
638 | 630 | _hg_cmd_export() { |
|
639 | 631 | _arguments -s -S : $_hg_global_opts $_hg_diff_opts \ |
|
640 | 632 | '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \ |
|
641 | 633 | '--switch-parent[diff against the second parent]' \ |
|
642 | 634 | '*'{-r+,--rev=}'[revisions to export]:revision:_hg_labels' \ |
|
643 | 635 | '*:revision:_hg_labels' |
|
644 | 636 | } |
|
645 | 637 | |
|
646 | 638 | _hg_cmd_files() { |
|
647 | 639 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ |
|
648 | 640 | '(--rev -r)'{-r+,--rev=}'[search the repository as it is in REV]:revision:_hg_labels' \ |
|
649 | 641 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
650 | 642 | '*:file:_hg_files' |
|
651 | 643 | } |
|
652 | 644 | |
|
653 | 645 | _hg_cmd_forget() { |
|
654 | 646 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
655 | 647 | '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \ |
|
656 | 648 | '*:file:_hg_files' |
|
657 | 649 | } |
|
658 | 650 | |
|
659 | 651 | _hg_cmd_graft() { |
|
660 | 652 | _arguments -s -S : $_hg_global_opts $_hg_dryrun_opts \ |
|
661 | 653 | $_hg_date_user_opts $_hg_mergetool_opts \ |
|
662 | 654 | '*'{-r+,--rev=}'[revisions to graft]:revision:_hg_labels' \ |
|
663 | 655 | '(--continue -c --abort -a)'{-c,--continue}'[resume interrupted graft]' \ |
|
664 | 656 | '(--continue -c --abort -a)'{-a,--abort}'[abort interrupted graft]' \ |
|
665 | 657 | '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ |
|
666 | 658 | '--log[append graft info to log message]' \ |
|
667 | 659 | '*:revision:_hg_labels' |
|
668 | 660 | } |
|
669 | 661 | |
|
670 | 662 | _hg_cmd_grep() { |
|
671 | 663 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ |
|
672 | 664 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ |
|
673 | 665 | '--all[print all revisions with matches]' \ |
|
674 | 666 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ |
|
675 | 667 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ |
|
676 | 668 | '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ |
|
677 | 669 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ |
|
678 | 670 | '*'{-r+,--rev=}'[search in given revision range]:revision:_hg_revrange' \ |
|
679 | 671 | '(--user -u)'{-u,--user}'[print user who committed change]' \ |
|
680 | 672 | '(--date -d)'{-d,--date}'[print date of a changeset]' \ |
|
681 | 673 | '1:search pattern:' \ |
|
682 | 674 | '*:files:_hg_files' |
|
683 | 675 | } |
|
684 | 676 | |
|
685 | 677 | _hg_cmd_heads() { |
|
686 | 678 | _arguments -s -S : $_hg_global_opts $_hg_template_opts \ |
|
687 | 679 | '(--topo -t)'{-t,--topo}'[show topological heads only]' \ |
|
688 | 680 | '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \ |
|
689 | 681 | '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of rev]:revision:_hg_labels' |
|
690 | 682 | } |
|
691 | 683 | |
|
692 | 684 | _hg_cmd_help() { |
|
693 | 685 | _arguments -s -S : $_hg_global_opts \ |
|
694 | 686 | '(--extension -e)'{-e,--extension}'[show only help for extensions]' \ |
|
695 | 687 | '(--command -c)'{-c,--command}'[show only help for commands]' \ |
|
696 | 688 | '(--keyword -k)'{-k,--keyword}'[show topics matching keyword]' \ |
|
697 | 689 | '*:mercurial help topic:_hg_help_topics' |
|
698 | 690 | } |
|
699 | 691 | |
|
700 | 692 | _hg_cmd_identify() { |
|
701 | 693 | _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ |
|
702 | 694 | '(--rev -r)'{-r+,--rev=}'[identify the specified rev]:revision:_hg_labels' \ |
|
703 | 695 | '(--num -n)'{-n,--num}'[show local revision number]' \ |
|
704 | 696 | '(--id -i)'{-i,--id}'[show global revision id]' \ |
|
705 | 697 | '(--branch -b)'{-b,--branch}'[show branch]' \ |
|
706 | 698 | '(--bookmarks -B)'{-B,--bookmarks}'[show bookmarks]' \ |
|
707 | 699 | '(--tags -t)'{-t,--tags}'[show tags]' |
|
708 | 700 | } |
|
709 | 701 | |
|
710 | 702 | _hg_cmd_import() { |
|
711 | 703 | _arguments -s -S : $_hg_global_opts $_hg_commit_opts \ |
|
712 | 704 | '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count' \ |
|
713 | 705 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ |
|
714 | 706 | '--bypass[apply patch without touching the working directory]' \ |
|
715 | 707 | '--no-commit[do not commit, just update the working directory]' \ |
|
716 | 708 | '--partial[commit even if some hunks fail]' \ |
|
717 | 709 | '--exact[abort if patch would apply lossily]' \ |
|
718 | 710 | '--import-branch[use any branch information in patch (implied by --exact)]' \ |
|
719 | 711 | '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ |
|
720 | 712 | '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ |
|
721 | 713 | '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \ |
|
722 | 714 | '*:patch:_files' |
|
723 | 715 | } |
|
724 | 716 | |
|
725 | 717 | _hg_cmd_incoming() { |
|
726 | 718 | _arguments -s -S : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \ |
|
727 | 719 | $_hg_subrepos_opts \ |
|
728 | 720 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
729 | 721 | '*'{-r+,--rev=}'[a remote changeset intended to be added]:revision:_hg_labels' \ |
|
730 | 722 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
731 | 723 | '--bundle[file to store the bundles into]:bundle file:_files' \ |
|
732 | 724 | ':source:_hg_remote' |
|
733 | 725 | } |
|
734 | 726 | |
|
735 | 727 | _hg_cmd_init() { |
|
736 | 728 | _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ |
|
737 | 729 | ':dir:_files -/' |
|
738 | 730 | } |
|
739 | 731 | |
|
740 | 732 | _hg_cmd_locate() { |
|
741 | 733 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ |
|
742 | 734 | '(--rev -r)'{-r+,--rev=}'[search repository as it stood at revision]:revision:_hg_labels' \ |
|
743 | 735 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
744 | 736 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths from the filesystem root]' \ |
|
745 | 737 | '*:search pattern:_hg_files' |
|
746 | 738 | } |
|
747 | 739 | |
|
748 | 740 | _hg_cmd_log() { |
|
749 | 741 | _arguments -s -S : $_hg_log_opts $_hg_pat_opts \ |
|
750 | 742 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ |
|
751 | 743 | '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ |
|
752 | 744 | '(--copies -C)'{-C,--copies}'[show copied files]' \ |
|
753 | 745 | '*'{-k+,--keyword=}'[search for a keyword]:keyword' \ |
|
754 | 746 | '*'{-r+,--rev=}'[show the specified revision or revset]:revision:_hg_revrange' \ |
|
755 | 747 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ |
|
756 | 748 | '*'{-P+,--prune=}'[do not display revision or any of its ancestors]:revision:_hg_labels' \ |
|
757 | 749 | '*'{-b+,--branch=}'[show changesets within the given named branch]:branch:_hg_branches' \ |
|
758 | 750 | '*'{-u+,--user=}'[revisions committed by user]:user' \ |
|
759 | 751 | '(--date -d)'{-d+,--date=}'[show revisions matching date spec]:date' \ |
|
760 | 752 | '*:files:_hg_files' |
|
761 | 753 | } |
|
762 | 754 | |
|
763 | 755 | _hg_cmd_manifest() { |
|
764 | 756 | _arguments -s -S : $_hg_global_opts \ |
|
765 | 757 | '--all[list files from all revisions]' \ |
|
766 | 758 | '(--rev -r)'{-r+,--rev=}'[revision to display]:revision:_hg_labels' \ |
|
767 | 759 | ':revision:_hg_labels' |
|
768 | 760 | } |
|
769 | 761 | |
|
770 | 762 | _hg_cmd_merge() { |
|
771 | 763 | _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \ |
|
772 | 764 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ |
|
773 | 765 | '(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \ |
|
774 | 766 | '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \ |
|
775 | 767 | ':revision:_hg_mergerevs' |
|
776 | 768 | } |
|
777 | 769 | |
|
778 | 770 | _hg_cmd_outgoing() { |
|
779 | 771 | _arguments -s -S : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \ |
|
780 | 772 | $_hg_subrepos_opts \ |
|
781 | 773 | '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \ |
|
782 | 774 | '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_revrange' \ |
|
783 | 775 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
784 | 776 | ':destination:_hg_remote' |
|
785 | 777 | } |
|
786 | 778 | |
|
787 | 779 | _hg_cmd_parents() { |
|
788 | 780 | _arguments -s -S : $_hg_global_opts $_hg_template_opts \ |
|
789 | 781 | '(--rev -r)'{-r+,--rev=}'[show parents of the specified rev]:revision:_hg_labels' \ |
|
790 | 782 | ':last modified file:_hg_files' |
|
791 | 783 | } |
|
792 | 784 | |
|
793 | 785 | _hg_cmd_paths() { |
|
794 | 786 | _arguments -s -S : $_hg_global_opts \ |
|
795 | 787 | ':path:_hg_paths' |
|
796 | 788 | } |
|
797 | 789 | |
|
798 | 790 | _hg_cmd_phase() { |
|
799 | 791 | _arguments -s -S : $_hg_global_opts \ |
|
800 | 792 | '(--public -p --draft -d --secret -s)'{-p,--public}'[set changeset phase to public]' \ |
|
801 | 793 | '(--public -p --draft -d --secret -s)'{-d,--draft}'[set changeset phase to draft]' \ |
|
802 | 794 | '(--public -p --draft -d --secret -s)'{-s,--secret}'[set changeset phase to secret]' \ |
|
803 | 795 | '(--force -f)'{-f,--force}'[allow to move boundary backward]' \ |
|
804 | 796 | '*'{-r+,--rev=}'[target revision]:revision:_hg_labels' \ |
|
805 | 797 | '*:revision:_hg_labels' |
|
806 | 798 | } |
|
807 | 799 | |
|
808 | 800 | _hg_cmd_pull() { |
|
809 | 801 | _arguments -s -S : $_hg_global_opts $_hg_branch_bmark_opts $_hg_remote_opts \ |
|
810 | 802 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
811 | 803 | '(--update -u)'{-u,--update}'[update to new branch head if new descendants were pulled]' \ |
|
812 | 804 | '*'{-r+,--rev=}'[a remote changeset intended to be added]:revision:_hg_labels' \ |
|
813 | 805 | ':source:_hg_remote' |
|
814 | 806 | } |
|
815 | 807 | |
|
816 | 808 | _hg_cmd_push() { |
|
817 | 809 | _arguments -s -S : $_hg_global_opts $_hg_branch_bmark_opts $_hg_remote_opts \ |
|
818 | 810 | '(--force -f)'{-f,--force}'[force push]' \ |
|
819 | 811 | '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_labels' \ |
|
820 | 812 | '--new-branch[allow pushing a new branch]' \ |
|
821 | 813 | ':destination:_hg_remote' |
|
822 | 814 | } |
|
823 | 815 | |
|
824 | 816 | _hg_cmd_remove() { |
|
825 | 817 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \ |
|
826 | 818 | '(--after -A)'{-A,--after}'[record delete for missing files]' \ |
|
827 | 819 | '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \ |
|
828 | 820 | '*:file:_hg_files' |
|
829 | 821 | } |
|
830 | 822 | |
|
831 | 823 | _hg_cmd_rename() { |
|
832 | 824 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
833 | 825 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ |
|
834 | 826 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
835 | 827 | '*:file:_hg_files' |
|
836 | 828 | } |
|
837 | 829 | |
|
838 | 830 | _hg_cmd_resolve() { |
|
839 | 831 | local context state state_descr line ret=1 |
|
840 | 832 | typeset -A opt_args |
|
841 | 833 | |
|
842 | 834 | _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \ |
|
843 | 835 | '(--all -a)'{-a,--all}'[select all unresolved files]' \ |
|
844 | 836 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ |
|
845 | 837 | '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \ |
|
846 | 838 | '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \ |
|
847 | 839 | '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[mark files as unresolved]:*:resolved files:_hg_resolved' \ |
|
848 | 840 | '*:file:_hg_unresolved' && ret=0 |
|
849 | 841 | |
|
850 | 842 | if [[ $state == 'resolve_files' ]] |
|
851 | 843 | then |
|
852 | 844 | _alternative 'files:resolved files:_hg_resolved' \ |
|
853 | 845 | 'files:unresolved files:_hg_unresolved' && ret=0 |
|
854 | 846 | fi |
|
855 | 847 | |
|
856 | 848 | return ret |
|
857 | 849 | } |
|
858 | 850 | |
|
859 | 851 | _hg_cmd_revert() { |
|
860 | 852 | local context state state_descr line ret=1 |
|
861 | 853 | typeset -A opt_args |
|
862 | 854 | |
|
863 | 855 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
864 | 856 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ |
|
865 | 857 | '(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_labels' \ |
|
866 | 858 | '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \ |
|
867 | 859 | '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \ |
|
868 | 860 | '(--interactive -i)'{-i,--interactive}'[interactively select the changes]' \ |
|
869 | 861 | '*:file:->revert_files' && ret=0 |
|
870 | 862 | |
|
871 | 863 | if [[ $state == 'revert_files' ]] |
|
872 | 864 | then |
|
873 | 865 | if [[ -n ${opt_args[(I)-r|--rev]} ]] |
|
874 | 866 | then |
|
875 | 867 | _hg_files && ret=0 |
|
876 | 868 | else |
|
877 | 869 | typeset -a status_files |
|
878 | 870 | _hg_status mard |
|
879 | 871 | _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files && ret=0 |
|
880 | 872 | fi |
|
881 | 873 | fi |
|
882 | 874 | |
|
883 | 875 | return ret |
|
884 | 876 | } |
|
885 | 877 | |
|
886 | 878 | _hg_cmd_rollback() { |
|
887 | 879 | _arguments -s -S : $_hg_global_opts $_hg_dryrun_opts \ |
|
888 | 880 | '(--force -f)'{-f,--force}'[ignore safety measures]' \ |
|
889 | 881 | } |
|
890 | 882 | |
|
891 | 883 | _hg_cmd_serve() { |
|
892 | 884 | _arguments -s -S : $_hg_global_opts $_hg_subrepos_opts \ |
|
893 | 885 | '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write to]:log file:_files' \ |
|
894 | 886 | '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log file:_files' \ |
|
895 | 887 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ |
|
896 | 888 | '(--port -p)'{-p+,--port=}'[port to listen on (default: 8000)]:listen port' \ |
|
897 | 889 | '(--address -a)'{-a+,--address=}'[address to listen on (default: all interfaces)]:interface address' \ |
|
898 | 890 | '--prefix=[prefix path to serve from (default: server root)]:directory:_files' \ |
|
899 | 891 | '(--name -n)'{-n+,--name=}'[name to show in web pages (default: working directory)]:repository name' \ |
|
900 | 892 | '--web-conf=[name of the hgweb config file]:config file:_files' \ |
|
901 | 893 | '--pid-file=[name of file to write process ID to]:pid file:_files' \ |
|
902 | 894 | '--cmdserver[for remote clients]' \ |
|
903 | 895 | '(--templates -t)'{-t+,--templates=}'[web template directory]:template dir:_files -/' \ |
|
904 | 896 | '--style=[template style to use]:style' \ |
|
905 | 897 | '--stdio[for remote clients]' \ |
|
906 | 898 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' \ |
|
907 | 899 | '--certificate=[SSL certificate file]:certificate file:_files' \ |
|
908 | 900 | '--print-url[start and print only the URL]' |
|
909 | 901 | } |
|
910 | 902 | |
|
911 | 903 | _hg_cmd_showconfig() { |
|
912 | 904 | _arguments -s -S : $_hg_global_opts \ |
|
913 | 905 | '(--untrusted -u)'{-u,--untrusted}'[show untrusted configuration options]' \ |
|
914 | 906 | '(--edit -e)'{-e,--edit}'[edit user config]' \ |
|
915 | 907 | '(--local -l --global -g)'{-l,--local}'[edit repository config]' \ |
|
916 | 908 | '(--local -l --global -g)'{-g,--global}'[edit global config]' \ |
|
917 | 909 | '*:config item:_hg_config' |
|
918 | 910 | } |
|
919 | 911 | |
|
920 | 912 | _hg_cmd_status() { |
|
921 | 913 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ |
|
922 | 914 | '(--all -A)'{-A,--all}'[show status of all files]' \ |
|
923 | 915 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ |
|
924 | 916 | '(--added -a)'{-a,--added}'[show only added files]' \ |
|
925 | 917 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ |
|
926 | 918 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ |
|
927 | 919 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ |
|
928 | 920 | '(--unknown -u)'{-u,--unknown}'[show only unknown (not tracked) files]' \ |
|
929 | 921 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ |
|
930 | 922 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ |
|
931 | 923 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ |
|
932 | 924 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
933 | 925 | '*--rev=[show difference from revision]:revision:_hg_labels' \ |
|
934 | 926 | '--change=[list the changed files of a revision]:revision:_hg_labels' \ |
|
935 | 927 | '*:files:_files' |
|
936 | 928 | } |
|
937 | 929 | |
|
938 | 930 | _hg_cmd_summary() { |
|
939 | 931 | _arguments -s -S : $_hg_global_opts \ |
|
940 | 932 | '--remote[check for push and pull]' |
|
941 | 933 | } |
|
942 | 934 | |
|
943 | 935 | _hg_cmd_tag() { |
|
944 | 936 | _arguments -s -S : $_hg_global_opts \ |
|
945 | 937 | '(--local -l)'{-l,--local}'[make the tag local]' \ |
|
946 | 938 | '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message' \ |
|
947 | 939 | '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ |
|
948 | 940 | '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ |
|
949 | 941 | '(--rev -r)'{-r+,--rev=}'[revision to tag]:revision:_hg_labels' \ |
|
950 | 942 | '(--force -f)'{-f,--force}'[force tag]' \ |
|
951 | 943 | '--remove[remove a tag]' \ |
|
952 | 944 | '(--edit -e)'{-e,--edit}'[edit commit message]' \ |
|
953 | 945 | ':tag name:' |
|
954 | 946 | } |
|
955 | 947 | |
|
956 | 948 | _hg_cmd_tip() { |
|
957 | 949 | _arguments -s -S : $_hg_global_opts $_hg_gitlike_opts $_hg_template_opts \ |
|
958 | 950 | '(--patch -p)'{-p,--patch}'[show patch]' |
|
959 | 951 | } |
|
960 | 952 | |
|
961 | 953 | _hg_cmd_unbundle() { |
|
962 | 954 | _arguments -s -S : $_hg_global_opts \ |
|
963 | 955 | '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ |
|
964 | 956 | '*:files:_files' |
|
965 | 957 | } |
|
966 | 958 | |
|
967 | 959 | _hg_cmd_update() { |
|
968 | 960 | _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \ |
|
969 | 961 | '(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \ |
|
970 | 962 | '(--check -c)'{-c,--check}'[require clean working directory]' \ |
|
971 | 963 | '(--merge -m)'{-m,--merge}'[merge uncommitted changes]' \ |
|
972 | 964 | '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \ |
|
973 | 965 | '(--rev -r 1)'{-r+,--rev=}'[revision]:revision:_hg_labels' \ |
|
974 | 966 | ':revision:_hg_labels' |
|
975 | 967 | } |
|
976 | 968 | |
|
977 | 969 | ## extensions ## |
|
978 | 970 | |
|
979 | 971 | # HGK |
|
980 | 972 | _hg_cmd_view() { |
|
981 | 973 | _arguments -s -S : $_hg_global_opts \ |
|
982 | 974 | '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \ |
|
983 | 975 | ':revision range:_hg_labels' |
|
984 | 976 | } |
|
985 | 977 | |
|
986 | 978 | # MQ |
|
987 | 979 | _hg_qseries() { |
|
988 | 980 | typeset -a patches |
|
989 | 981 | patches=(${(f)"$(_hg_cmd qseries)"}) |
|
990 | 982 | (( $#patches )) && _describe -t hg-patches 'patches' patches |
|
991 | 983 | } |
|
992 | 984 | |
|
993 | 985 | _hg_qapplied() { |
|
994 | 986 | typeset -a patches |
|
995 | 987 | patches=(${(f)"$(_hg_cmd qapplied)"}) |
|
996 | 988 | if (( $#patches )) |
|
997 | 989 | then |
|
998 | 990 | patches+=(qbase qtip) |
|
999 | 991 | _describe -t hg-applied-patches 'applied patches' patches |
|
1000 | 992 | fi |
|
1001 | 993 | } |
|
1002 | 994 | |
|
1003 | 995 | _hg_qunapplied() { |
|
1004 | 996 | typeset -a patches |
|
1005 | 997 | patches=(${(f)"$(_hg_cmd qunapplied)"}) |
|
1006 | 998 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches |
|
1007 | 999 | } |
|
1008 | 1000 | |
|
1009 | 1001 | # unapplied, including guarded patches |
|
1010 | 1002 | _hg_qdeletable() { |
|
1011 | 1003 | typeset -a unapplied |
|
1012 | 1004 | unapplied=(${(f)"$(_hg_cmd qseries)"}) |
|
1013 | 1005 | for p in $(_hg_cmd qapplied) |
|
1014 | 1006 | do |
|
1015 | 1007 | unapplied=(${unapplied:#$p}) |
|
1016 | 1008 | done |
|
1017 | 1009 | |
|
1018 | 1010 | (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied |
|
1019 | 1011 | } |
|
1020 | 1012 | |
|
1021 | 1013 | _hg_qguards() { |
|
1022 | 1014 | typeset -a guards |
|
1023 | 1015 | local guard |
|
1024 | 1016 | compset -P "+|-" |
|
1025 | 1017 | _hg_cmd qselect -s | while read guard |
|
1026 | 1018 | do |
|
1027 | 1019 | guards+=(${guard#(+|-)}) |
|
1028 | 1020 | done |
|
1029 | 1021 | (( $#guards )) && _describe -t hg-guards 'guards' guards |
|
1030 | 1022 | } |
|
1031 | 1023 | |
|
1032 | 1024 | _hg_qseries_opts=( |
|
1033 | 1025 | '(--summary -s)'{-s,--summary}'[print first line of patch header]') |
|
1034 | 1026 | |
|
1035 | 1027 | _hg_cmd_qapplied() { |
|
1036 | 1028 | _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \ |
|
1037 | 1029 | '(--last -1)'{-1,--last}'[show only the preceding applied patch]' \ |
|
1038 | 1030 | '*:patch:_hg_qapplied' |
|
1039 | 1031 | } |
|
1040 | 1032 | |
|
1041 | 1033 | _hg_cmd_qclone() { |
|
1042 | 1034 | _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_clone_opts \ |
|
1043 | 1035 | '(--patches -p)'{-p+,--patches=}'[location of source patch repository]:' \ |
|
1044 | 1036 | ':source repository:_hg_remote' \ |
|
1045 | 1037 | ':destination:_hg_clone_dest' |
|
1046 | 1038 | } |
|
1047 | 1039 | |
|
1048 | 1040 | _hg_cmd_qdelete() { |
|
1049 | 1041 | _arguments -s -S : $_hg_global_opts \ |
|
1050 | 1042 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ |
|
1051 | 1043 | '*'{-r+,--rev=}'[stop managing a revision]:applied patch:_hg_revrange' \ |
|
1052 | 1044 | '*:unapplied patch:_hg_qdeletable' |
|
1053 | 1045 | } |
|
1054 | 1046 | |
|
1055 | 1047 | _hg_cmd_qdiff() { |
|
1056 | 1048 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ |
|
1057 | 1049 | $_hg_ignore_space_opts \ |
|
1058 | 1050 | '*:pattern:_hg_files' |
|
1059 | 1051 | } |
|
1060 | 1052 | |
|
1061 | 1053 | _hg_cmd_qfinish() { |
|
1062 | 1054 | _arguments -s -S : $_hg_global_opts \ |
|
1063 | 1055 | '(--applied -a)'{-a,--applied}'[finish all applied patches]' \ |
|
1064 | 1056 | '*:patch:_hg_qapplied' |
|
1065 | 1057 | } |
|
1066 | 1058 | |
|
1067 | 1059 | _hg_cmd_qfold() { |
|
1068 | 1060 | _arguments -s -S : $_hg_global_opts $_hg_commit_opts \ |
|
1069 | 1061 | '(--keep -k)'{-k,--keep}'[keep folded patch files]' \ |
|
1070 | 1062 | '(--force -f)'{-f,--force}'[overwrite any local changes]' \ |
|
1071 | 1063 | '--no-backup[do not save backup copies of files]' \ |
|
1072 | 1064 | '*:unapplied patch:_hg_qunapplied' |
|
1073 | 1065 | } |
|
1074 | 1066 | |
|
1075 | 1067 | _hg_cmd_qgoto() { |
|
1076 | 1068 | _arguments -s -S : $_hg_global_opts \ |
|
1077 | 1069 | '(--force -f)'{-f,--force}'[overwrite any local changes]' \ |
|
1078 | 1070 | '--keep-changes[tolerate non-conflicting local changes]' \ |
|
1079 | 1071 | ':patch:_hg_qseries' |
|
1080 | 1072 | } |
|
1081 | 1073 | |
|
1082 | 1074 | _hg_cmd_qguard() { |
|
1083 | 1075 | _arguments -s -S : $_hg_global_opts \ |
|
1084 | 1076 | '(--list -l)'{-l,--list}'[list all patches and guards]' \ |
|
1085 | 1077 | '(--none -n)'{-n,--none}'[drop all guards]' \ |
|
1086 | 1078 | ':patch:_hg_qseries' \ |
|
1087 | 1079 | '*:guards:_hg_qguards' |
|
1088 | 1080 | } |
|
1089 | 1081 | |
|
1090 | 1082 | _hg_cmd_qheader() { |
|
1091 | 1083 | _arguments -s -S : $_hg_global_opts \ |
|
1092 | 1084 | ':patch:_hg_qseries' |
|
1093 | 1085 | } |
|
1094 | 1086 | |
|
1095 | 1087 | _hg_cmd_qimport() { |
|
1096 | 1088 | _arguments -s -S : $_hg_global_opts $_hg_gitlike_opts \ |
|
1097 | 1089 | '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ |
|
1098 | 1090 | '(--name -n 2)'{-n+,--name}'[patch file name]:name' \ |
|
1099 | 1091 | '(--force -f)'{-f,--force}'[overwrite existing files]' \ |
|
1100 | 1092 | '*'{-r+,--rev=}'[place existing revisions under mq control]:revision:_hg_revrange' \ |
|
1101 | 1093 | '(--push -P)'{-P,--push}'[qpush after importing]' \ |
|
1102 | 1094 | '*:patch:_files' |
|
1103 | 1095 | } |
|
1104 | 1096 | |
|
1105 | 1097 | _hg_cmd_qnew() { |
|
1106 | 1098 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \ |
|
1107 | 1099 | ':patch:' |
|
1108 | 1100 | } |
|
1109 | 1101 | |
|
1110 | 1102 | _hg_cmd_qnext() { |
|
1111 | 1103 | _arguments -s -S : $_hg_global_opts $_hg_qseries_opts |
|
1112 | 1104 | } |
|
1113 | 1105 | |
|
1114 | 1106 | _hg_cmd_qpop() { |
|
1115 | 1107 | _arguments -s -S : $_hg_global_opts \ |
|
1116 | 1108 | '(--all -a :)'{-a,--all}'[pop all patches]' \ |
|
1117 | 1109 | '(--force -f)'{-f,--force}'[forget any local changes]' \ |
|
1118 | 1110 | '--keep-changes[tolerate non-conflicting local changes]' \ |
|
1119 | 1111 | '--no-backup[do not save backup copies of files]' \ |
|
1120 | 1112 | ':patch:_hg_qapplied' |
|
1121 | 1113 | } |
|
1122 | 1114 | |
|
1123 | 1115 | _hg_cmd_qprev() { |
|
1124 | 1116 | _arguments -s -S : $_hg_global_opts $_hg_qseries_opts |
|
1125 | 1117 | } |
|
1126 | 1118 | |
|
1127 | 1119 | _hg_cmd_qpush() { |
|
1128 | 1120 | _arguments -s -S : $_hg_global_opts \ |
|
1129 | 1121 | '(--all -a :)'{-a,--all}'[apply all patches]' \ |
|
1130 | 1122 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ |
|
1131 | 1123 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ |
|
1132 | 1124 | '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \ |
|
1133 | 1125 | '--move[reorder patch series and apply only the patch]' \ |
|
1134 | 1126 | '--keep-changes[tolerate non-conflicting local changes]' \ |
|
1135 | 1127 | '--no-backup[do not save backup copies of files]' \ |
|
1136 | 1128 | ':patch:_hg_qunapplied' |
|
1137 | 1129 | } |
|
1138 | 1130 | |
|
1139 | 1131 | _hg_cmd_qrefresh() { |
|
1140 | 1132 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \ |
|
1141 | 1133 | '(--short -s)'{-s,--short}'[short refresh]' \ |
|
1142 | 1134 | '*:files:_hg_files' |
|
1143 | 1135 | } |
|
1144 | 1136 | |
|
1145 | 1137 | _hg_cmd_qrename() { |
|
1146 | 1138 | _arguments -s -S : $_hg_global_opts \ |
|
1147 | 1139 | ':patch:_hg_qunapplied' \ |
|
1148 | 1140 | ':destination:' |
|
1149 | 1141 | } |
|
1150 | 1142 | |
|
1151 | 1143 | _hg_cmd_qselect() { |
|
1152 | 1144 | _arguments -s -S : $_hg_global_opts \ |
|
1153 | 1145 | '(--none -n :)'{-n,--none}'[disable all guards]' \ |
|
1154 | 1146 | '(--series -s :)'{-s,--series}'[list all guards in series file]' \ |
|
1155 | 1147 | '--pop[pop to before first guarded applied patch]' \ |
|
1156 | 1148 | '--reapply[pop and reapply patches]' \ |
|
1157 | 1149 | '*:guards:_hg_qguards' |
|
1158 | 1150 | } |
|
1159 | 1151 | |
|
1160 | 1152 | _hg_cmd_qseries() { |
|
1161 | 1153 | _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \ |
|
1162 | 1154 | '(--missing -m)'{-m,--missing}'[print patches not in series]' |
|
1163 | 1155 | } |
|
1164 | 1156 | |
|
1165 | 1157 | _hg_cmd_qunapplied() { |
|
1166 | 1158 | _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \ |
|
1167 | 1159 | '(--first -1)'{-1,--first}'[show only the first patch]' |
|
1168 | 1160 | } |
|
1169 | 1161 | |
|
1170 | 1162 | _hg_cmd_qtop() { |
|
1171 | 1163 | _arguments -s -S : $_hg_global_opts $_hg_qseries_opts |
|
1172 | 1164 | } |
|
1173 | 1165 | |
|
1174 | 1166 | _hg_cmd_strip() { |
|
1175 | 1167 | _arguments -s -S : $_hg_global_opts \ |
|
1176 | 1168 | '(--force -f)'{-f,--force}'[force removal of changesets, discard uncommitted changes (no backup)]' \ |
|
1177 | 1169 | '--no-backup[no backups]' \ |
|
1178 | 1170 | '(--keep -k)'{-k,--keep}'[do not modify working directory during strip]' \ |
|
1179 | 1171 | '*'{-B+,--bookmark=}'[remove revs only reachable from given bookmark]:bookmark:_hg_bookmarks' \ |
|
1180 | 1172 | '*'{-r+,--rev=}'[revision]:revision:_hg_labels' \ |
|
1181 | 1173 | '*:revision:_hg_labels' |
|
1182 | 1174 | } |
|
1183 | 1175 | |
|
1184 | 1176 | # Patchbomb |
|
1185 | 1177 | _hg_cmd_email() { |
|
1186 | 1178 | _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_gitlike_opts \ |
|
1187 | 1179 | '--plain[omit hg patch header]' \ |
|
1188 | 1180 | '--body[send patches as inline message text (default)]' \ |
|
1189 | 1181 | '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \ |
|
1190 | 1182 | '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \ |
|
1191 | 1183 | '--bundlename[name of the bundle attachment file (default: bundle)]:' \ |
|
1192 | 1184 | '*'{-r+,--rev=}'[search in given revision range]:revision:_hg_revrange' \ |
|
1193 | 1185 | '--force[run even when remote repository is unrelated (with -b/--bundle)]' \ |
|
1194 | 1186 | '*--base=[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \ |
|
1195 | 1187 | '--intro[send an introduction email for a single patch]' \ |
|
1196 | 1188 | '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \ |
|
1197 | 1189 | '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \ |
|
1198 | 1190 | '*--bcc=[email addresses of blind carbon copy recipients]:email' \ |
|
1199 | 1191 | '*'{-c+,--cc=}'[email addresses of copy recipients]:email' \ |
|
1200 | 1192 | '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \ |
|
1201 | 1193 | '--date=[use the given date as the sending date]:date' \ |
|
1202 | 1194 | '--desc=[use the given file as the series description]:files:_files' \ |
|
1203 | 1195 | '(--from -f)'{-f+,--from=}'[email address of sender]:email' \ |
|
1204 | 1196 | '(--test -n)'{-n,--test}'[print messages that would be sent]' \ |
|
1205 | 1197 | '(--mbox -m)'{-m+,--mbox=}'[write messages to mbox file instead of sending them]:file:_files' \ |
|
1206 | 1198 | '*--reply-to=[email addresses replies should be sent to]:email' \ |
|
1207 | 1199 | '(--subject -s)'{-s+,--subject=}'[subject of first message (intro or single patch)]:subject' \ |
|
1208 | 1200 | '--in-reply-to=[message identifier to reply to]:msgid' \ |
|
1209 | 1201 | '*--flag=[flags to add in subject prefixes]:flag' \ |
|
1210 | 1202 | '*'{-t+,--to=}'[email addresses of recipients]:email' \ |
|
1211 | 1203 | ':revision:_hg_revrange' |
|
1212 | 1204 | } |
|
1213 | 1205 | |
|
1214 | 1206 | # Rebase |
|
1215 | 1207 | _hg_cmd_rebase() { |
|
1216 | 1208 | _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts $_hg_dryrun_opts \ |
|
1217 | 1209 | '*'{-r+,--rev=}'[rebase these revisions]:revision:_hg_revrange' \ |
|
1218 | 1210 | '(--source -s --base -b)'{-s+,--source=}'[rebase the specified changeset and descendants]:revision:_hg_labels' \ |
|
1219 | 1211 | '(--source -s --base -b)'{-b+,--base=}'[rebase everything from branching point of specified changeset]:revision:_hg_labels' \ |
|
1220 | 1212 | '(--dest -d)'{-d+,--dest=}'[rebase onto the specified changeset]:revision:_hg_labels' \ |
|
1221 | 1213 | '--collapse[collapse the rebased changesets]' \ |
|
1222 | 1214 | '(--keep -k)'{-k,--keep}'[keep original changesets]' \ |
|
1223 | 1215 | '--keepbranches[keep original branch names]' \ |
|
1224 | 1216 | '(--continue -c --abort -a)'{-c,--continue}'[continue an interrupted rebase]' \ |
|
1225 | 1217 | '(--continue -c --abort -a)'{-a,--abort}'[abort an interrupted rebase]' \ |
|
1226 | 1218 | } |
|
1227 | 1219 | |
|
1228 | 1220 | # Record |
|
1229 | 1221 | _hg_cmd_record() { |
|
1230 | 1222 | _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_pat_opts \ |
|
1231 | 1223 | $_hg_ignore_space_opts $_hg_subrepos_opts \ |
|
1232 | 1224 | '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ |
|
1233 | 1225 | '--close-branch[mark a branch as closed, hiding it from the branch list]' \ |
|
1234 | 1226 | '--amend[amend the parent of the working dir]' \ |
|
1235 | 1227 | '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ |
|
1236 | 1228 | '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' |
|
1237 | 1229 | } |
|
1238 | 1230 | |
|
1239 | 1231 | _hg_cmd_qrecord() { |
|
1240 | 1232 | _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \ |
|
1241 | 1233 | $_hg_pat_opts $_hg_ignore_space_opts $_hg_subrepos_opts |
|
1242 | 1234 | } |
|
1243 | 1235 | |
|
1244 | 1236 | # Convert |
|
1245 | 1237 | _hg_cmd_convert() { |
|
1246 | 1238 | _arguments -s -S : $_hg_global_opts \ |
|
1247 | 1239 | '(--source-type -s)'{-s+,--source-type=}'[source repository type]:type:(hg cvs darcs git svn mtn gnuarch bzr p4)' \ |
|
1248 | 1240 | '(--dest-type -d)'{-d+,--dest-type=}'[destination repository type]:type:(hg svn)' \ |
|
1249 | 1241 | '*'{-r+,--rev=}'[import up to target revision]:revision' \ |
|
1250 | 1242 | '(--authormap -A)'{-A+,--authormap=}'[remap usernames using this file]:file:_files' \ |
|
1251 | 1243 | '--filemap=[remap file names using contents of file]:file:_files' \ |
|
1252 | 1244 | '--full[apply filemap changes by converting all files again]' \ |
|
1253 | 1245 | '--splicemap=[splice synthesized history into place]:file:_files' \ |
|
1254 | 1246 | '--branchmap=[change branch names while converting]:file:_files' \ |
|
1255 | 1247 | '--branchsort[try to sort changesets by branches]' \ |
|
1256 | 1248 | '--datesort[try to sort changesets by date]' \ |
|
1257 | 1249 | '--sourcesort[preserve source changesets order]' \ |
|
1258 | 1250 | '--closesort[try to reorder closed revisions]' |
|
1259 | 1251 | } |
|
1260 | 1252 | |
|
1261 | 1253 | # Purge |
|
1262 | 1254 | _hg_cmd_purge() { |
|
1263 | 1255 | _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ |
|
1264 | 1256 | '(--abort-on-err -a)'{-a,--abort-on-err}'[abort if an error occurs]' \ |
|
1265 | 1257 | '--all[purge ignored files too]' \ |
|
1266 | 1258 | '(--print -p)'{-p,--print}'[print filenames instead of deleting them]' \ |
|
1267 | 1259 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs (implies -p/--print)]' |
|
1268 | 1260 | } |
|
1269 | 1261 | |
|
1270 | 1262 | _hg "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now