Show More
@@ -1,419 +1,423 b'' | |||||
1 | #compdef hg |
|
1 | #compdef hg | |
2 |
|
2 | |||
3 | # Zsh completion script for mercurial. Rename this file to _hg and copy |
|
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 |
|
4 | # it into your zsh function path (/usr/share/zsh/site-functions for | |
5 | # instance) |
|
5 | # instance) | |
6 | # |
|
6 | # | |
7 | # Copyright (C) 2005 Steve Borho |
|
7 | # Copyright (C) 2005 Steve Borho | |
8 | # |
|
8 | # | |
9 | # This is free software; you can redistribute it and/or modify it under |
|
9 | # This is free software; you can redistribute it and/or modify it under | |
10 | # the terms of the GNU General Public License as published by the Free |
|
10 | # the terms of the GNU General Public License as published by the Free | |
11 | # Software Foundation; either version 2 of the License, or (at your |
|
11 | # Software Foundation; either version 2 of the License, or (at your | |
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 tags newFiles addedFiles includeExclude |
|
17 | local subcmds repos tags newFiles addedFiles includeExclude | |
18 |
|
18 | |||
19 | tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')) |
|
19 | tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')) | |
20 | subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ |
|
20 | subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ | |
21 | -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:].*//g;')) |
|
21 | -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:].*//g;')) | |
22 |
|
22 | |||
23 | # A lot of commands have these arguments |
|
23 | # A lot of commands have these arguments | |
24 | includeExclude=( |
|
24 | includeExclude=( | |
25 | '*-I-[include names matching the given patterns]:dir:_files -W $(hg root) -/' |
|
25 | '*-I-[include names matching the given patterns]:dir:_files -W $(hg root) -/' | |
26 | '*--include-[include names matching the given patterns]:dir:_files -W $(hg root) -/' |
|
26 | '*--include-[include names matching the given patterns]:dir:_files -W $(hg root) -/' | |
27 | '*-X-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/' |
|
27 | '*-X-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/' | |
28 | '*--exclude-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/') |
|
28 | '*--exclude-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/') | |
29 |
|
29 | |||
30 | if [[ $service == "hg" ]]; then |
|
30 | if [[ $service == "hg" ]]; then | |
31 | _arguments -C -A "-*" \ |
|
31 | _arguments -C -A "-*" \ | |
32 | '(--repository)-R[repository root directory]:root:_files -/' \ |
|
32 | '(--repository)-R[repository root directory]:root:_files -/' \ | |
33 | '(-R)--repository[repository root directory]:root:_files -/' \ |
|
33 | '(-R)--repository[repository root directory]:root:_files -/' \ | |
34 | '--cwd[change working directory]:new working directory:_files -/' \ |
|
34 | '--cwd[change working directory]:new working directory:_files -/' \ | |
35 | '(--noninteractive)-y[do not prompt, assume yes for any required answers]' \ |
|
35 | '(--noninteractive)-y[do not prompt, assume yes for any required answers]' \ | |
36 | '(-y)--noninteractive[do not prompt, assume yes for any required answers]' \ |
|
36 | '(-y)--noninteractive[do not prompt, assume yes for any required answers]' \ | |
37 | '(--verbose)-v[enable additional output]' \ |
|
37 | '(--verbose)-v[enable additional output]' \ | |
38 | '(-v)--verbose[enable additional output]' \ |
|
38 | '(-v)--verbose[enable additional output]' \ | |
39 | '(--quiet)-q[suppress output]' \ |
|
39 | '(--quiet)-q[suppress output]' \ | |
40 | '(-q)--quiet[suppress output]' \ |
|
40 | '(-q)--quiet[suppress output]' \ | |
41 | '(--help)-h[display help and exit]' \ |
|
41 | '(--help)-h[display help and exit]' \ | |
42 | '(-h)--help[display help and exit]' \ |
|
42 | '(-h)--help[display help and exit]' \ | |
43 | '--debug[debug mode]' \ |
|
43 | '--debug[debug mode]' \ | |
44 | '--debugger[start debugger]' \ |
|
44 | '--debugger[start debugger]' \ | |
45 | '--traceback[print traceback on exception]' \ |
|
45 | '--traceback[print traceback on exception]' \ | |
46 | '--time[time how long the command takes]' \ |
|
46 | '--time[time how long the command takes]' \ | |
47 | '--profile[profile]' \ |
|
47 | '--profile[profile]' \ | |
48 | '--version[output version information and exit]' \ |
|
48 | '--version[output version information and exit]' \ | |
49 | '*::command:->subcmd' && return 0 |
|
49 | '*::command:->subcmd' && return 0 | |
50 |
|
50 | |||
51 | if (( CURRENT == 1 )); then |
|
51 | if (( CURRENT == 1 )); then | |
52 | _wanted commands expl 'hg command' compadd -a subcmds |
|
52 | _wanted commands expl 'hg command' compadd -a subcmds | |
53 | return |
|
53 | return | |
54 | fi |
|
54 | fi | |
55 | service="$words[1]" |
|
55 | service="$words[1]" | |
56 | curcontext="${curcontext%:*}=$service:" |
|
56 | curcontext="${curcontext%:*}=$service:" | |
57 | fi |
|
57 | fi | |
58 |
|
58 | |||
59 | case $service in |
|
59 | case $service in | |
60 | (add) |
|
60 | (add) | |
61 | newFiles=( $(hg status -un) ) |
|
61 | newFiles=( $(hg status -un) ) | |
62 | _arguments $includeExclude \ |
|
62 | _arguments $includeExclude \ | |
63 | '*:file:->unknown' |
|
63 | '*:file:->unknown' | |
64 | _wanted files expl 'unknown files' compadd -a newFiles |
|
64 | _wanted files expl 'unknown files' compadd -a newFiles | |
65 | ;; |
|
65 | ;; | |
66 |
|
66 | |||
67 | (addremove) |
|
67 | (addremove) | |
68 | _arguments $includeExclude \ |
|
68 | _arguments $includeExclude \ | |
69 | '*:directories:_files -/' # assume they want to add/remove a dir |
|
69 | '*:directories:_files -/' # assume they want to add/remove a dir | |
70 | ;; |
|
70 | ;; | |
71 |
|
71 | |||
72 | (forget) |
|
72 | (forget) | |
73 | addedFiles=( $(hg status -an) ) |
|
73 | addedFiles=( $(hg status -an) ) | |
74 | _arguments $includeExclude \ |
|
74 | _arguments $includeExclude \ | |
75 | '*:file:->added' |
|
75 | '*:file:->added' | |
76 | _wanted files expl 'newly added files' compadd -a addedFiles |
|
76 | _wanted files expl 'newly added files' compadd -a addedFiles | |
77 | ;; |
|
77 | ;; | |
78 |
|
78 | |||
79 | (remove|rm) |
|
79 | (remove|rm) | |
80 | _arguments $includeExclude \ |
|
80 | _arguments $includeExclude \ | |
81 | '*:file:_files' |
|
81 | '*:file:_files' | |
82 | ;; |
|
82 | ;; | |
83 |
|
83 | |||
84 | (copy|cp) |
|
84 | (copy|cp) | |
85 | _arguments $includeExclude \ |
|
85 | _arguments $includeExclude \ | |
86 | '(--after)-A[record a copy that has already occurred]' \ |
|
86 | '(--after)-A[record a copy that has already occurred]' \ | |
87 | '(-A)--after[record a copy that has already occurred]' \ |
|
87 | '(-A)--after[record a copy that has already occurred]' \ | |
88 | '(--force)-f[forcibly copy over an existing managed file]' \ |
|
88 | '(--force)-f[forcibly copy over an existing managed file]' \ | |
89 | '(-f)--force[forcibly copy over an existing managed file]' \ |
|
89 | '(-f)--force[forcibly copy over an existing managed file]' \ | |
90 | '(--parents)-p[append source path to dest]' \ |
|
90 | '(--parents)-p[append source path to dest]' \ | |
91 | '(-p)--parents[append source path to dest]' \ |
|
91 | '(-p)--parents[append source path to dest]' \ | |
92 | '*:files:_files' |
|
92 | '*:files:_files' | |
93 | ;; |
|
93 | ;; | |
94 |
|
94 | |||
95 | (rename|mv) |
|
95 | (rename|mv) | |
96 | if (( CURRENT == 2 )); then |
|
96 | if (( CURRENT == 2 )); then | |
97 | _arguments $includeExclude \ |
|
97 | _arguments $includeExclude \ | |
98 | '(--after)-A[record a rename that has already occurred]' \ |
|
98 | '(--after)-A[record a rename that has already occurred]' \ | |
99 | '(-A)--after[record a rename that has already occurred]' \ |
|
99 | '(-A)--after[record a rename that has already occurred]' \ | |
100 | '(--force)-f[replace destination if it exists]' \ |
|
100 | '(--force)-f[replace destination if it exists]' \ | |
101 | '(-F)--force[replace destination if it exists]' \ |
|
101 | '(-F)--force[replace destination if it exists]' \ | |
102 | '(--parents)-p[append source path to dest]' \ |
|
102 | '(--parents)-p[append source path to dest]' \ | |
103 | '(-p)--parents[append source path to dest]' \ |
|
103 | '(-p)--parents[append source path to dest]' \ | |
104 | '*:files:_files' |
|
104 | '*:files:_files' | |
105 | else |
|
105 | else | |
106 | _arguments '*:destination:_files' |
|
106 | _arguments '*:destination:_files' | |
107 | fi |
|
107 | fi | |
108 | ;; |
|
108 | ;; | |
109 |
|
109 | |||
110 | (diff) |
|
110 | (diff) | |
111 | _arguments $includeExclude \ |
|
111 | _arguments $includeExclude \ | |
112 | '*-r[revision]:revision:($tags)' \ |
|
112 | '*-r[revision]:revision:($tags)' \ | |
113 | '*--rev[revision]:revision:($tags)' \ |
|
113 | '*--rev[revision]:revision:($tags)' \ | |
114 | '(--text)-a[treat all files as text]' \ |
|
114 | '(--text)-a[treat all files as text]' \ | |
115 | '(-a)--text[treat all files as text]' \ |
|
115 | '(-a)--text[treat all files as text]' \ | |
116 | '*:file:_files' |
|
116 | '*:file:_files' | |
117 | ;; |
|
117 | ;; | |
118 |
|
118 | |||
119 | (status) |
|
119 | (status) | |
120 | _arguments $includeExclude \ |
|
120 | _arguments $includeExclude \ | |
121 | '(--no-status)-n[hide status prefix]' \ |
|
121 | '(--no-status)-n[hide status prefix]' \ | |
122 | '(-n)--no-status[hide status prefix]' \ |
|
122 | '(-n)--no-status[hide status prefix]' \ | |
123 | '(--print0)-0[end filenames with NUL, for use with xargs]' \ |
|
123 | '(--print0)-0[end filenames with NUL, for use with xargs]' \ | |
124 | '(-0)--print0[end filenames with NUL, for use with xargs]' \ |
|
124 | '(-0)--print0[end filenames with NUL, for use with xargs]' \ | |
125 | '(--modified)-m[show only modified files]' \ |
|
125 | '(--modified)-m[show only modified files]' \ | |
126 | '(-m)--modified[show only modified files]' \ |
|
126 | '(-m)--modified[show only modified files]' \ | |
127 | '(--added)-a[show only added files]' \ |
|
127 | '(--added)-a[show only added files]' \ | |
128 | '(-a)--added[show only added files]' \ |
|
128 | '(-a)--added[show only added files]' \ | |
129 | '(--removed)-r[show only removed files]' \ |
|
129 | '(--removed)-r[show only removed files]' \ | |
130 | '(-r)--removed[show only removed files]' \ |
|
130 | '(-r)--removed[show only removed files]' \ | |
131 | '(--unknown)-u[show only unknown files]' \ |
|
131 | '(--unknown)-u[show only unknown files]' \ | |
132 | '(-u)--unknown[show only unknown files]' \ |
|
132 | '(-u)--unknown[show only unknown files]' \ | |
133 | '*:search pattern, then files:_files' |
|
133 | '*:search pattern, then files:_files' | |
134 | ;; |
|
134 | ;; | |
135 |
|
135 | |||
136 | (revert) |
|
136 | (revert) | |
137 | addedFiles=( $(hg status -mrn) ) # modified, removed |
|
137 | addedFiles=( $(hg status -mrn) ) # modified, removed | |
138 | _arguments \ |
|
138 | _arguments \ | |
139 | '(--rev)-r[revision to revert to]:revision:($tags)' \ |
|
139 | '(--rev)-r[revision to revert to]:revision:($tags)' \ | |
140 | '(-r)--rev[revision to revert to]:revision:($tags)' \ |
|
140 | '(-r)--rev[revision to revert to]:revision:($tags)' \ | |
141 | '(--nonrecursive)-n[do not recurse into subdirectories]' \ |
|
141 | '(--nonrecursive)-n[do not recurse into subdirectories]' \ | |
142 | '(-n)--nonrecursive[do not recurse into subdirectories]' \ |
|
142 | '(-n)--nonrecursive[do not recurse into subdirectories]' \ | |
143 | '*:file:->modified' |
|
143 | '*:file:->modified' | |
144 | _wanted files expl 'mofified files' compadd -a addedFiles |
|
144 | _wanted files expl 'mofified files' compadd -a addedFiles | |
145 | ;; |
|
145 | ;; | |
146 |
|
146 | |||
147 | (commit|ci) |
|
147 | (commit|ci) | |
148 | addedFiles=( $(hg status -amrn) ) # added, modified, removed |
|
148 | addedFiles=( $(hg status -amrn) ) # added, modified, removed | |
149 | _arguments $includeExclude \ |
|
149 | _arguments $includeExclude \ | |
150 | '(--addremove)-A[run addremove during commit]' \ |
|
150 | '(--addremove)-A[run addremove during commit]' \ | |
151 | '(-A)--addremove[run addremove during commit]' \ |
|
151 | '(-A)--addremove[run addremove during commit]' \ | |
152 | '(--message)-m[use <txt> as commit message]:string:' \ |
|
152 | '(--message)-m[use <txt> as commit message]:string:' \ | |
153 | '(-m)--message[use <txt> as commit message]:string:' \ |
|
153 | '(-m)--message[use <txt> as commit message]:string:' \ | |
154 | '(--logfile)-l[read commit message from <file>]:.log file:_file -g \*.txt' \ |
|
154 | '(--logfile)-l[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
155 | '(-l)--logfile[read commit message from <file>]:.log file:_file -g \*.txt' \ |
|
155 | '(-l)--logfile[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
156 | '(--date)-d[record datecode as commit date]:date code:' \ |
|
156 | '(--date)-d[record datecode as commit date]:date code:' \ | |
157 | '(-d)--date[record datecode as commit date]:date code:' \ |
|
157 | '(-d)--date[record datecode as commit date]:date code:' \ | |
158 | '(--user)-u[record user as commiter]:user:' \ |
|
158 | '(--user)-u[record user as commiter]:user:' \ | |
159 | '(-u)--user[record user as commiter]:user:' \ |
|
159 | '(-u)--user[record user as commiter]:user:' \ | |
160 | '*:file:->modified' |
|
160 | '*:file:->modified' | |
161 | _wanted files expl 'mofified files' compadd -a addedFiles |
|
161 | _wanted files expl 'mofified files' compadd -a addedFiles | |
162 | ;; |
|
162 | ;; | |
163 |
|
163 | |||
164 | (cat) |
|
164 | (cat) | |
165 | _arguments $includeExclude \ |
|
165 | _arguments $includeExclude \ | |
166 | '(--output)-o[print output to file with formatted name]:filespec:' \ |
|
166 | '(--output)-o[print output to file with formatted name]:filespec:' \ | |
167 | '(-o)--output[print output to file with formatted name]:filespec:' \ |
|
167 | '(-o)--output[print output to file with formatted name]:filespec:' \ | |
168 | '(--rev)-r[revision]:revision:($tags)' \ |
|
168 | '(--rev)-r[revision]:revision:($tags)' \ | |
169 | '(-r)--rev[revision]:revision:($tags)' \ |
|
169 | '(-r)--rev[revision]:revision:($tags)' \ | |
170 | '*:file:_files' |
|
170 | '*:file:_files' | |
171 | ;; |
|
171 | ;; | |
172 |
|
172 | |||
173 | (annotate) |
|
173 | (annotate) | |
174 | _arguments $includeExclude \ |
|
174 | _arguments $includeExclude \ | |
175 | '(--rev)-r[annotate the specified revision]:revision:($tags)' \ |
|
175 | '(--rev)-r[annotate the specified revision]:revision:($tags)' \ | |
176 | '(-r)--rev[annotate the specified revision]:revision:($tags)' \ |
|
176 | '(-r)--rev[annotate the specified revision]:revision:($tags)' \ | |
177 | '(--text)-a[treat all files as text]' \ |
|
177 | '(--text)-a[treat all files as text]' \ | |
178 | '(-a)--text[treat all files as text]' \ |
|
178 | '(-a)--text[treat all files as text]' \ | |
179 | '(--user)-u[list the author]' \ |
|
179 | '(--user)-u[list the author]' \ | |
180 | '(-u)--user[list the author]' \ |
|
180 | '(-u)--user[list the author]' \ | |
181 | '(--changeset)-c[list the changeset]' \ |
|
181 | '(--changeset)-c[list the changeset]' \ | |
182 | '(-c)--changeset[list the changeset]' \ |
|
182 | '(-c)--changeset[list the changeset]' \ | |
183 | '(--number)-n[list the revision number (default)]' \ |
|
183 | '(--number)-n[list the revision number (default)]' \ | |
184 | '(-n)--number[list the revision number (default)]' \ |
|
184 | '(-n)--number[list the revision number (default)]' \ | |
185 | '*:files:_files' |
|
185 | '*:files:_files' | |
186 | ;; |
|
186 | ;; | |
187 |
|
187 | |||
188 | (grep) |
|
188 | (grep) | |
189 | _arguments $includeExclude \ |
|
189 | _arguments $includeExclude \ | |
190 | '*-r[search in given revision range]:revision:($tags)' \ |
|
190 | '*-r[search in given revision range]:revision:($tags)' \ | |
191 | '*--rev[search in given revision range]:revision:($tags)' \ |
|
191 | '*--rev[search in given revision range]:revision:($tags)' \ | |
192 | '--all[print all revisions with matches]' \ |
|
192 | '--all[print all revisions with matches]' \ | |
193 | '(-print0)-0[end filenames with NUL, for use with xargs]' \ |
|
193 | '(-print0)-0[end filenames with NUL, for use with xargs]' \ | |
194 | '(-0)--print0[end filenames with NUL, for use with xargs]' \ |
|
194 | '(-0)--print0[end filenames with NUL, for use with xargs]' \ | |
195 | '(--ignore-case)-i[ignore case when matching]' \ |
|
195 | '(--ignore-case)-i[ignore case when matching]' \ | |
196 | '(-i)--ignore-case[ignore case when matching]' \ |
|
196 | '(-i)--ignore-case[ignore case when matching]' \ | |
197 | '(--files-with-matches)-l[print names of files and revs that match]' \ |
|
197 | '(--files-with-matches)-l[print names of files and revs that match]' \ | |
198 | '(-l)--files-with-matches[print names of files and revs that match]' \ |
|
198 | '(-l)--files-with-matches[print names of files and revs that match]' \ | |
199 | '(--line-number)-n[print matching line numbers]' \ |
|
199 | '(--line-number)-n[print matching line numbers]' \ | |
200 | '(-n)--line-number[print matching line numbers]' \ |
|
200 | '(-n)--line-number[print matching line numbers]' \ | |
201 | '(--user)-u[print user who committed change]' \ |
|
201 | '(--user)-u[print user who committed change]' \ | |
202 | '(-u)--user[print user who committed change]' \ |
|
202 | '(-u)--user[print user who committed change]' \ | |
203 | '*:search pattern:' |
|
203 | '*:search pattern:' | |
204 | ;; |
|
204 | ;; | |
205 |
|
205 | |||
206 | (locate) |
|
206 | (locate) | |
207 | _arguments $includeExclude \ |
|
207 | _arguments $includeExclude \ | |
208 | '(--rev)-r[search repository as it stood at revision]:revision:($tags)' \ |
|
208 | '(--rev)-r[search repository as it stood at revision]:revision:($tags)' \ | |
209 | '(-r)--rev[search repository as it stood at revision]:revision:($tags)' \ |
|
209 | '(-r)--rev[search repository as it stood at revision]:revision:($tags)' \ | |
210 | '(--print0)-0[end filenames with NUL, for use with xargs]' \ |
|
210 | '(--print0)-0[end filenames with NUL, for use with xargs]' \ | |
211 | '(-0)--print0[end filenames with NUL, for use with xargs]' \ |
|
211 | '(-0)--print0[end filenames with NUL, for use with xargs]' \ | |
212 | '(--fullpath)-f[print complete paths]' \ |
|
212 | '(--fullpath)-f[print complete paths]' \ | |
213 | '(-f)--fullpath[print complete paths]' \ |
|
213 | '(-f)--fullpath[print complete paths]' \ | |
214 | '*:search pattern:' |
|
214 | '*:search pattern:' | |
215 | ;; |
|
215 | ;; | |
216 |
|
216 | |||
217 | (log|history) |
|
217 | (log|history) | |
218 | _arguments $includeExclude \ |
|
218 | _arguments $includeExclude \ | |
219 | '*-r[show the specified revision or range]:revision:($tags)' \ |
|
219 | '*-r[show the specified revision or range]:revision:($tags)' \ | |
220 | '*--rev[show the specified revision or range]:revision:($tags)' \ |
|
220 | '*--rev[show the specified revision or range]:revision:($tags)' \ | |
221 | '(--no-merges -M --only-merges)-m[show only merge revisions]' \ |
|
221 | '(--no-merges -M --only-merges)-m[show only merge revisions]' \ | |
222 | '(--no-merges -M -m)--only-merges[show only merge revisions]' \ |
|
222 | '(--no-merges -M -m)--only-merges[show only merge revisions]' \ | |
223 | '(--only-merges -m --no-merges)-M[do not show merge revisions]' \ |
|
223 | '(--only-merges -m --no-merges)-M[do not show merge revisions]' \ | |
224 | '(--only-merges -m -M)--no-merges[do not show merge revisions]' \ |
|
224 | '(--only-merges -m -M)--no-merges[do not show merge revisions]' \ | |
225 | '(--keyword)-k[search for a keyword]:keyword:' \ |
|
225 | '(--keyword)-k[search for a keyword]:keyword:' \ | |
226 | '(-k)--keyword[search for a keyword]:keyword:' \ |
|
226 | '(-k)--keyword[search for a keyword]:keyword:' \ | |
227 | '(--branch)-b[show branches]' \ |
|
227 | '(--branch)-b[show branches]' \ | |
228 | '(-b)--branch[show branches]' \ |
|
228 | '(-b)--branch[show branches]' \ | |
229 | '(--patch)-p[show patch]' \ |
|
229 | '(--patch)-p[show patch]' \ | |
230 | '(-p)--patch[show patch]' \ |
|
230 | '(-p)--patch[show patch]' \ | |
231 | '*:file:_files' |
|
231 | '*:file:_files' | |
232 | ;; |
|
232 | ;; | |
233 |
|
233 | |||
234 | (update|checkout|co) |
|
234 | (update|checkout|co) | |
235 | _arguments \ |
|
235 | _arguments \ | |
236 | '(--branch)-b[checkout the head of a specific branch]' \ |
|
236 | '(--branch)-b[checkout the head of a specific branch]' \ | |
237 | '(-b)--branch[checkout the head of a specific branch]' \ |
|
237 | '(-b)--branch[checkout the head of a specific branch]' \ | |
238 | '(-C --clean --merge)-m[allow merging of branches]' \ |
|
238 | '(-C --clean --merge)-m[allow merging of branches]' \ | |
239 | '(-C --clean -m)--merge[allow merging of branches]' \ |
|
239 | '(-C --clean -m)--merge[allow merging of branches]' \ | |
240 | '(-m --merge --clean)-C[overwrite locally modified files]' \ |
|
240 | '(-m --merge --clean)-C[overwrite locally modified files]' \ | |
241 | '(-m --merge -C)--clean[overwrite locally modified files]' \ |
|
241 | '(-m --merge -C)--clean[overwrite locally modified files]' \ | |
242 | '*:revision or tag:($tags)' |
|
242 | '*:revision or tag:($tags)' | |
243 | ;; |
|
243 | ;; | |
244 |
|
244 | |||
245 | (tag) |
|
245 | (tag) | |
246 | _arguments \ |
|
246 | _arguments \ | |
247 | '(--local)-l[make the tag local]' \ |
|
247 | '(--local)-l[make the tag local]' \ | |
248 | '(-l)--local[make the tag local]' \ |
|
248 | '(-l)--local[make the tag local]' \ | |
249 | '(--message)-m[message for tag commit log entry]:string:' \ |
|
249 | '(--message)-m[message for tag commit log entry]:string:' \ | |
250 | '(-m)--message[message for tag commit log entry]:string:' \ |
|
250 | '(-m)--message[message for tag commit log entry]:string:' \ | |
251 | '(--date)-d[record datecode as commit date]:date code:' \ |
|
251 | '(--date)-d[record datecode as commit date]:date code:' \ | |
252 | '(-d)--date[record datecode as commit date]:date code:' \ |
|
252 | '(-d)--date[record datecode as commit date]:date code:' \ | |
253 | '(--user)-u[record user as commiter]:user:' \ |
|
253 | '(--user)-u[record user as commiter]:user:' \ | |
254 | '(-u)--user[record user as commiter]:user:' \ |
|
254 | '(-u)--user[record user as commiter]:user:' \ | |
255 | '*:name, then revision:($tags)' |
|
255 | '*:name, then revision:($tags)' | |
256 | ;; |
|
256 | ;; | |
257 |
|
257 | |||
258 | (clone) |
|
258 | (clone) | |
259 | if (( CURRENT == 2 )); then |
|
259 | if (( CURRENT == 2 )); then | |
260 | _arguments \ |
|
260 | _arguments \ | |
261 | '(--no-update)-U[do not update the new working directory]' \ |
|
261 | '(--no-update)-U[do not update the new working directory]' \ | |
262 | '(-U)--no-update[do not update the new working directory]' \ |
|
262 | '(-U)--no-update[do not update the new working directory]' \ | |
263 | '(--ssh)-e[specify ssh command to use]:string:' \ |
|
263 | '(--ssh)-e[specify ssh command to use]:string:' \ | |
264 | '(-e)--ssh[specify ssh command to use]:string:' \ |
|
264 | '(-e)--ssh[specify ssh command to use]:string:' \ | |
265 | '--pull[use pull protocol to copy metadata]' \ |
|
265 | '--pull[use pull protocol to copy metadata]' \ | |
266 | '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ |
|
266 | '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ | |
267 | '*:local repo:_files -/' |
|
267 | '*:local repo:_files -/' | |
268 | elif (( CURRENT == 3 )); then |
|
268 | elif (( CURRENT == 3 )); then | |
269 | _arguments '*:dest repo:_files -/' |
|
269 | _arguments '*:dest repo:_files -/' | |
270 | fi |
|
270 | fi | |
271 | ;; |
|
271 | ;; | |
272 |
|
272 | |||
273 | (rawcommit) |
|
273 | (rawcommit) | |
274 | _arguments \ |
|
274 | _arguments \ | |
275 | '(--parent)-p[parent revision]:revision:($tags)' \ |
|
275 | '(--parent)-p[parent revision]:revision:($tags)' \ | |
276 | '(-p)--parent[parent revision]:revision:($tags)' \ |
|
276 | '(-p)--parent[parent revision]:revision:($tags)' \ | |
277 | '(--date)-d[record datecode as commit date]:date code:' \ |
|
277 | '(--date)-d[record datecode as commit date]:date code:' \ | |
278 | '(-d)--date[record datecode as commit date]:date code:' \ |
|
278 | '(-d)--date[record datecode as commit date]:date code:' \ | |
279 | '(--user)-u[record user as commiter]:user:' \ |
|
279 | '(--user)-u[record user as commiter]:user:' \ | |
280 | '(-u)--user[record user as commiter]:user:' \ |
|
280 | '(-u)--user[record user as commiter]:user:' \ | |
281 | '(--message)-m[use <txt> as commit message]:string:' \ |
|
281 | '(--message)-m[use <txt> as commit message]:string:' \ | |
282 | '(-m)--message[use <txt> as commit message]:string:' \ |
|
282 | '(-m)--message[use <txt> as commit message]:string:' \ | |
283 | '(--logfile)-l[read commit message from <file>]:.log file:_file -g \*.txt' \ |
|
283 | '(--logfile)-l[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
284 | '(-l)--logfile[read commit message from <file>]:.log file:_file -g \*.txt' \ |
|
284 | '(-l)--logfile[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
285 | '(--files)-F[file list]:file list:_files' \ |
|
285 | '(--files)-F[file list]:file list:_files' \ | |
286 | '(-F)--files[file list]:file list:_files' \ |
|
286 | '(-F)--files[file list]:file list:_files' \ | |
287 | '*:files to commit:_files' |
|
287 | '*:files to commit:_files' | |
288 | ;; |
|
288 | ;; | |
289 |
|
289 | |||
290 | (bundle) |
|
290 | (bundle) | |
291 | if (( CURRENT == 2 )); then |
|
291 | if (( CURRENT == 2 )); then | |
292 | _arguments '*:changegroup file:_files -g \*.hg' |
|
292 | _arguments '*:changegroup file:_files -g \*.hg' | |
293 | elif (( CURRENT == 3 )); then |
|
293 | elif (( CURRENT == 3 )); then | |
294 | _arguments '*:other repo:_files -/' |
|
294 | _arguments '*:other repo:_files -/' | |
295 | fi |
|
295 | fi | |
296 | ;; |
|
296 | ;; | |
297 |
|
297 | |||
298 | (unbundle) |
|
298 | (unbundle) | |
299 | _arguments '*:changegroup .hg file:_files -g \*.hg' |
|
299 | _arguments '*:changegroup .hg file:_files -g \*.hg' | |
300 | ;; |
|
300 | ;; | |
301 |
|
301 | |||
302 | (incoming) |
|
302 | (incoming) | |
303 | _arguments \ |
|
303 | _arguments \ | |
304 | '(--patch)-p[show patch]' \ |
|
304 | '(--patch)-p[show patch]' \ | |
305 | '(-p)--patch[show patch]' \ |
|
305 | '(-p)--patch[show patch]' \ | |
306 | '(--no-merges)-M[do not show merge revisions]' \ |
|
306 | '(--no-merges)-M[do not show merge revisions]' \ | |
307 | '(-M)--no-merges[do not show merge revisions]' \ |
|
307 | '(-M)--no-merges[do not show merge revisions]' \ | |
|
308 | '(--newest-first)-n[show newest record first]' \ | |||
|
309 | '(-n)--newest-first[show newest record first]' \ | |||
308 | '*:mercurial repository:_files -/' |
|
310 | '*:mercurial repository:_files -/' | |
309 | ;; |
|
311 | ;; | |
310 |
|
312 | |||
311 | (import|patch) |
|
313 | (import|patch) | |
312 | _arguments \ |
|
314 | _arguments \ | |
313 | '(--strip)-p[directory strip option for patch (default: 1)]:count:' \ |
|
315 | '(--strip)-p[directory strip option for patch (default: 1)]:count:' \ | |
314 | '(-p)--strip[directory strip option for patch (default: 1)]:count:' \ |
|
316 | '(-p)--strip[directory strip option for patch (default: 1)]:count:' \ | |
315 | '(--force)-f[skip check for outstanding uncommitted changes]' \ |
|
317 | '(--force)-f[skip check for outstanding uncommitted changes]' \ | |
316 | '(-f)--force[skip check for outstanding uncommitted changes]' \ |
|
318 | '(-f)--force[skip check for outstanding uncommitted changes]' \ | |
317 | '(--base)-b[base directory to read patches from]:file:_files -W $(hg root) -/' \ |
|
319 | '(--base)-b[base directory to read patches from]:file:_files -W $(hg root) -/' \ | |
318 | '(-b)--base[base directory to read patches from]:file:_files -W $(hg root) -/' \ |
|
320 | '(-b)--base[base directory to read patches from]:file:_files -W $(hg root) -/' \ | |
319 | '*:patch file:_files' |
|
321 | '*:patch file:_files' | |
320 | ;; |
|
322 | ;; | |
321 |
|
323 | |||
322 | (pull) |
|
324 | (pull) | |
323 | repos=( $(hg paths | sed -e 's/^.*= //') ) |
|
325 | repos=( $(hg paths | sed -e 's/^.*= //') ) | |
324 | _arguments \ |
|
326 | _arguments \ | |
325 | '(--update)-u[update working directory to tip after pull]' \ |
|
327 | '(--update)-u[update working directory to tip after pull]' \ | |
326 | '(-u)--update[update working directory to tip after pull]' \ |
|
328 | '(-u)--update[update working directory to tip after pull]' \ | |
327 | '(--ssh)-e[specify ssh command to use]:ssh command:' \ |
|
329 | '(--ssh)-e[specify ssh command to use]:ssh command:' \ | |
328 | '(-e)--ssh[specify ssh command to use]:ssh command:' \ |
|
330 | '(-e)--ssh[specify ssh command to use]:ssh command:' \ | |
329 | '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ |
|
331 | '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ | |
330 | '*:local repo:_files -/' |
|
332 | '*:local repo:_files -/' | |
331 | _wanted source expl 'source repository' compadd -a repos |
|
333 | _wanted source expl 'source repository' compadd -a repos | |
332 | ;; |
|
334 | ;; | |
333 |
|
335 | |||
334 | (outgoing) |
|
336 | (outgoing) | |
335 | _arguments \ |
|
337 | _arguments \ | |
336 | '(--patch)-p[show patch]' \ |
|
338 | '(--patch)-p[show patch]' \ | |
337 | '(-p)--patch[show patch]' \ |
|
339 | '(-p)--patch[show patch]' \ | |
338 | '(--no-merges)-M[do not show merge revisions]' \ |
|
340 | '(--no-merges)-M[do not show merge revisions]' \ | |
339 | '(-M)--no-merges[do not show merge revisions]' \ |
|
341 | '(-M)--no-merges[do not show merge revisions]' \ | |
|
342 | '(--newest-first)-n[show newest record first]' \ | |||
|
343 | '(-n)--newest-first[show newest record first]' \ | |||
340 | '*:local repo:_files -/' |
|
344 | '*:local repo:_files -/' | |
341 | _wanted source expl 'source repository' compadd -a repos |
|
345 | _wanted source expl 'source repository' compadd -a repos | |
342 | ;; |
|
346 | ;; | |
343 |
|
347 | |||
344 | (export) |
|
348 | (export) | |
345 | _arguments \ |
|
349 | _arguments \ | |
346 | '(--outout)-o[print output to file with formatted name]:filespec:' \ |
|
350 | '(--outout)-o[print output to file with formatted name]:filespec:' \ | |
347 | '(-o)--output[print output to file with formatted name]:filespec:' \ |
|
351 | '(-o)--output[print output to file with formatted name]:filespec:' \ | |
348 | '(--text)-a[treat all files as text]' \ |
|
352 | '(--text)-a[treat all files as text]' \ | |
349 | '(-a)--text[treat all files as text]' \ |
|
353 | '(-a)--text[treat all files as text]' \ | |
350 | '*:revision:->revs' |
|
354 | '*:revision:->revs' | |
351 | _wanted revs expl 'revision or tag' compadd -a tags |
|
355 | _wanted revs expl 'revision or tag' compadd -a tags | |
352 | ;; |
|
356 | ;; | |
353 |
|
357 | |||
354 | (push) |
|
358 | (push) | |
355 | repos=( $(hg paths | sed -e 's/^.*= //') ) |
|
359 | repos=( $(hg paths | sed -e 's/^.*= //') ) | |
356 | _arguments \ |
|
360 | _arguments \ | |
357 | '(--force)-f[force push]' \ |
|
361 | '(--force)-f[force push]' \ | |
358 | '(-f)--force[force push]' \ |
|
362 | '(-f)--force[force push]' \ | |
359 | '(--ssh)-e[specify ssh command to use]:ssh command:' \ |
|
363 | '(--ssh)-e[specify ssh command to use]:ssh command:' \ | |
360 | '(-e)--ssh[specify ssh command to use]:ssh command:' \ |
|
364 | '(-e)--ssh[specify ssh command to use]:ssh command:' \ | |
361 | '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ |
|
365 | '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ | |
362 | '*:local repo:_files -/' |
|
366 | '*:local repo:_files -/' | |
363 | _wanted source expl 'source repository' compadd -a repos |
|
367 | _wanted source expl 'source repository' compadd -a repos | |
364 | ;; |
|
368 | ;; | |
365 |
|
369 | |||
366 | (serve) |
|
370 | (serve) | |
367 | _arguments \ |
|
371 | _arguments \ | |
368 | '(--accesslog)-A[name of access log file]:log file:_files' \ |
|
372 | '(--accesslog)-A[name of access log file]:log file:_files' \ | |
369 | '(-A)--accesslog[name of access log file]:log file:_files' \ |
|
373 | '(-A)--accesslog[name of access log file]:log file:_files' \ | |
370 | '(--errorlog)-E[name of error log file]:log file:_files' \ |
|
374 | '(--errorlog)-E[name of error log file]:log file:_files' \ | |
371 | '(-E)--errorlog[name of error log file]:log file:_files' \ |
|
375 | '(-E)--errorlog[name of error log file]:log file:_files' \ | |
372 | '(--port)-p[listen port]:listen port:' \ |
|
376 | '(--port)-p[listen port]:listen port:' \ | |
373 | '(-p)--port[listen port]:listen port:' \ |
|
377 | '(-p)--port[listen port]:listen port:' \ | |
374 | '(--address)-a[interface address]:interface address:' \ |
|
378 | '(--address)-a[interface address]:interface address:' \ | |
375 | '(-a)--address[interface address]:interface address:' \ |
|
379 | '(-a)--address[interface address]:interface address:' \ | |
376 | '(--name)-n[name to show in web pages]:repository name:' \ |
|
380 | '(--name)-n[name to show in web pages]:repository name:' \ | |
377 | '(-n)--name[name to show in web pages]:repository name:' \ |
|
381 | '(-n)--name[name to show in web pages]:repository name:' \ | |
378 | '(--templates)-t[web template directory]:template dir:_files -/' \ |
|
382 | '(--templates)-t[web template directory]:template dir:_files -/' \ | |
379 | '(-t)--templates[web template directory]:template dir:_files -/' \ |
|
383 | '(-t)--templates[web template directory]:template dir:_files -/' \ | |
380 | '--style[web template style]:style' \ |
|
384 | '--style[web template style]:style' \ | |
381 | '--stdio[for remote clients]' \ |
|
385 | '--stdio[for remote clients]' \ | |
382 | '(--ipv6)-6[use IPv6 in addition to IPv4]' \ |
|
386 | '(--ipv6)-6[use IPv6 in addition to IPv4]' \ | |
383 | '(-6)--ipv6[use IPv6 in addition to IPv4]' |
|
387 | '(-6)--ipv6[use IPv6 in addition to IPv4]' | |
384 | ;; |
|
388 | ;; | |
385 |
|
389 | |||
386 | (help) |
|
390 | (help) | |
387 | _wanted commands expl 'hg command' compadd -a subcmds |
|
391 | _wanted commands expl 'hg command' compadd -a subcmds | |
388 | ;; |
|
392 | ;; | |
389 |
|
393 | |||
390 | (heads) |
|
394 | (heads) | |
391 | _arguments \ |
|
395 | _arguments \ | |
392 | '(--branches)-b[find branch info]' \ |
|
396 | '(--branches)-b[find branch info]' \ | |
393 | '(-b)--branches[find branch info]' |
|
397 | '(-b)--branches[find branch info]' | |
394 | ;; |
|
398 | ;; | |
395 |
|
399 | |||
396 | (paths) |
|
400 | (paths) | |
397 | _arguments '*:symbolic name:(default default-push)' |
|
401 | _arguments '*:symbolic name:(default default-push)' | |
398 | ;; |
|
402 | ;; | |
399 |
|
403 | |||
400 | (init) |
|
404 | (init) | |
401 | _arguments '*:new repo directory:_files -/' |
|
405 | _arguments '*:new repo directory:_files -/' | |
402 | ;; |
|
406 | ;; | |
403 |
|
407 | |||
404 | (manifest) |
|
408 | (manifest) | |
405 | _arguments '*:revision:($tags)' |
|
409 | _arguments '*:revision:($tags)' | |
406 | ;; |
|
410 | ;; | |
407 |
|
411 | |||
408 | (parents) |
|
412 | (parents) | |
409 | _arguments '*:revision:($tags)' |
|
413 | _arguments '*:revision:($tags)' | |
410 | ;; |
|
414 | ;; | |
411 |
|
415 | |||
412 | (identify|recover|root|undo|view|verify|version|ct|tags) |
|
416 | (identify|recover|root|undo|view|verify|version|ct|tags) | |
413 | # no arguments for these commands |
|
417 | # no arguments for these commands | |
414 | ;; |
|
418 | ;; | |
415 |
|
419 | |||
416 | (*) |
|
420 | (*) | |
417 | _message "unknown hg command completion: $service" |
|
421 | _message "unknown hg command completion: $service" | |
418 | ;; |
|
422 | ;; | |
419 | esac |
|
423 | esac |
General Comments 0
You need to be logged in to leave comments.
Login now