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