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