equal
deleted
inserted
replaced
12 # option) any later version. |
12 # option) any later version. |
13 # |
13 # |
14 |
14 |
15 local curcontext="$curcontext" state line |
15 local curcontext="$curcontext" state line |
16 typeset -A opt_args |
16 typeset -A opt_args |
17 local subcmds repos newFiles addedFiles includeExclude commitMessage |
17 local repos newFiles addedFiles includeExclude commitMessage |
18 local ridx _hgroot |
18 local ridx _hgroot |
19 |
19 |
20 # FIXME: why isn't opt_args available? |
20 # FIXME: why isn't opt_args available? |
21 [[ -d .hg ]] && _hgroot="$PWD" |
21 [[ -d .hg ]] && _hgroot="$PWD" |
22 ridx=$words[(i)-R] |
22 ridx=$words[(i)-R] |
42 compadd $(_hg_cmd qunapplied) |
42 compadd $(_hg_cmd qunapplied) |
43 ;; |
43 ;; |
44 esac |
44 esac |
45 } |
45 } |
46 |
46 |
47 subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ |
47 (( $+_hg_commands )) || |
|
48 _hg_commands=($(hg -v help | sed -e '1,/^list of commands:/d' \ |
48 -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:].*//g;')) |
49 -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:].*//g;')) |
49 |
50 |
50 # A lot of commands have these arguments |
51 # A lot of commands have these arguments |
51 includeExclude=( |
52 includeExclude=( |
52 '*-I-[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' |
53 '*-I-[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' |
86 '--profile[profile]' \ |
87 '--profile[profile]' \ |
87 '--version[output version information and exit]' \ |
88 '--version[output version information and exit]' \ |
88 '*::command:->subcmd' && return 0 |
89 '*::command:->subcmd' && return 0 |
89 |
90 |
90 if (( CURRENT == 1 )); then |
91 if (( CURRENT == 1 )); then |
91 _wanted commands expl 'hg command' compadd -a subcmds |
92 _wanted commands expl 'hg command' compadd -a _hg_commands |
92 return |
93 return |
93 fi |
94 fi |
94 service="$words[1]" |
95 service="$words[1]" |
95 curcontext="${curcontext%:*}=$service:" |
96 curcontext="${curcontext%:*}=$service:" |
96 fi |
97 fi |
427 '(--ipv6)-6[use IPv6 in addition to IPv4]' \ |
428 '(--ipv6)-6[use IPv6 in addition to IPv4]' \ |
428 '(-6)--ipv6[use IPv6 in addition to IPv4]' |
429 '(-6)--ipv6[use IPv6 in addition to IPv4]' |
429 ;; |
430 ;; |
430 |
431 |
431 (help) |
432 (help) |
432 _wanted commands expl 'hg command' compadd -a subcmds |
433 _wanted commands expl 'hg command' compadd -a _hg_commands |
433 ;; |
434 ;; |
434 |
435 |
435 (heads) |
436 (heads) |
436 _arguments $styleOpts \ |
437 _arguments $styleOpts \ |
437 '(--branches)-b[find branch info]' \ |
438 '(--branches)-b[find branch info]' \ |