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