Show More
@@ -1,1090 +1,1100 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-10 Brendan Cully <brendan@kublai.com> |
|
17 | # Copyright (C) 2006-10 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 | while read -A hline |
|
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_labels "$@" |
|
162 | _hg_labels "$@" | |
163 | } |
|
163 | } | |
164 |
|
164 | |||
165 | _hg_labels() { |
|
165 | _hg_labels() { | |
166 | _hg_tags "$@" |
|
166 | _hg_tags "$@" | |
167 | _hg_bookmarks "$@" |
|
167 | _hg_bookmarks "$@" | |
168 | _hg_branches "$@" |
|
168 | _hg_branches "$@" | |
169 | } |
|
169 | } | |
170 |
|
170 | |||
171 | _hg_tags() { |
|
171 | _hg_tags() { | |
172 | typeset -a tags |
|
172 | typeset -a tags | |
173 | local tag rev |
|
173 | local tag rev | |
174 |
|
174 | |||
175 | _hg_cmd tags | while read tag |
|
175 | _hg_cmd tags | while read tag | |
176 | do |
|
176 | do | |
177 | tags+=(${tag/ # [0-9]#:*}) |
|
177 | tags+=(${tag/ # [0-9]#:*}) | |
178 | done |
|
178 | done | |
179 | (( $#tags )) && _describe -t tags 'tags' tags |
|
179 | (( $#tags )) && _describe -t tags 'tags' tags | |
180 | } |
|
180 | } | |
181 |
|
181 | |||
182 | _hg_bookmarks() { |
|
182 | _hg_bookmarks() { | |
183 | typeset -a bookmark bookmarks |
|
183 | typeset -a bookmark bookmarks | |
184 |
|
184 | |||
185 | _hg_cmd bookmarks | while read -A bookmark |
|
185 | _hg_cmd bookmarks | while read -A bookmark | |
186 | do |
|
186 | do | |
187 | if test -z ${bookmark[-1]:#[0-9]*} |
|
187 | if test -z ${bookmark[-1]:#[0-9]*} | |
188 | then |
|
188 | then | |
189 | bookmarks+=($bookmark[-2]) |
|
189 | bookmarks+=($bookmark[-2]) | |
190 | fi |
|
190 | fi | |
191 | done |
|
191 | done | |
192 | (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks |
|
192 | (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks | |
193 | } |
|
193 | } | |
194 |
|
194 | |||
195 | _hg_branches() { |
|
195 | _hg_branches() { | |
196 | typeset -a branches |
|
196 | typeset -a branches | |
197 | local branch |
|
197 | local branch | |
198 |
|
198 | |||
199 | _hg_cmd branches | while read branch |
|
199 | _hg_cmd branches | while read branch | |
200 | do |
|
200 | do | |
201 | branches+=(${branch/ # [0-9]#:*}) |
|
201 | branches+=(${branch/ # [0-9]#:*}) | |
202 | done |
|
202 | done | |
203 | (( $#branches )) && _describe -t branches 'branches' branches |
|
203 | (( $#branches )) && _describe -t branches 'branches' branches | |
204 | } |
|
204 | } | |
205 |
|
205 | |||
206 | # likely merge candidates |
|
206 | # likely merge candidates | |
207 | _hg_mergerevs() { |
|
207 | _hg_mergerevs() { | |
208 | typeset -a heads |
|
208 | typeset -a heads | |
209 | local myrev |
|
209 | local myrev | |
210 |
|
210 | |||
211 | heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"}) |
|
211 | heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"}) | |
212 | # exclude own revision |
|
212 | # exclude own revision | |
213 | myrev=$(_hg_cmd log -r . --template '{rev}\\n') |
|
213 | myrev=$(_hg_cmd log -r . --template '{rev}\\n') | |
214 | heads=(${heads:#$myrev}) |
|
214 | heads=(${heads:#$myrev}) | |
215 |
|
215 | |||
216 | (( $#heads )) && _describe -t heads 'heads' heads |
|
216 | (( $#heads )) && _describe -t heads 'heads' heads | |
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 | _hg_files() { |
|
219 | _hg_files() { | |
220 | if [[ -n "$_hg_root" ]] |
|
220 | if [[ -n "$_hg_root" ]] | |
221 | then |
|
221 | then | |
222 | [[ -d "$_hg_root/.hg" ]] || return |
|
222 | [[ -d "$_hg_root/.hg" ]] || return | |
223 | case "$_hg_root" in |
|
223 | case "$_hg_root" in | |
224 | /*) |
|
224 | /*) | |
225 | _files -W $_hg_root |
|
225 | _files -W $_hg_root | |
226 | ;; |
|
226 | ;; | |
227 | *) |
|
227 | *) | |
228 | _files -W $PWD/$_hg_root |
|
228 | _files -W $PWD/$_hg_root | |
229 | ;; |
|
229 | ;; | |
230 | esac |
|
230 | esac | |
231 | else |
|
231 | else | |
232 | _files |
|
232 | _files | |
233 | fi |
|
233 | fi | |
234 | } |
|
234 | } | |
235 |
|
235 | |||
236 | _hg_status() { |
|
236 | _hg_status() { | |
237 | [[ -d $PREFIX ]] || PREFIX=$PREFIX:h |
|
237 | [[ -d $PREFIX ]] || PREFIX=$PREFIX:h | |
238 | status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"}) |
|
238 | status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"}) | |
239 | } |
|
239 | } | |
240 |
|
240 | |||
241 | _hg_unknown() { |
|
241 | _hg_unknown() { | |
242 | typeset -a status_files |
|
242 | typeset -a status_files | |
243 | _hg_status u |
|
243 | _hg_status u | |
244 | _wanted files expl 'unknown files' _multi_parts / status_files |
|
244 | _wanted files expl 'unknown files' _multi_parts / status_files | |
245 | } |
|
245 | } | |
246 |
|
246 | |||
247 | _hg_missing() { |
|
247 | _hg_missing() { | |
248 | typeset -a status_files |
|
248 | typeset -a status_files | |
249 | _hg_status d |
|
249 | _hg_status d | |
250 | _wanted files expl 'missing files' _multi_parts / status_files |
|
250 | _wanted files expl 'missing files' _multi_parts / status_files | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | _hg_modified() { |
|
253 | _hg_modified() { | |
254 | typeset -a status_files |
|
254 | typeset -a status_files | |
255 | _hg_status m |
|
255 | _hg_status m | |
256 | _wanted files expl 'modified files' _multi_parts / status_files |
|
256 | _wanted files expl 'modified files' _multi_parts / status_files | |
257 | } |
|
257 | } | |
258 |
|
258 | |||
259 | _hg_resolve() { |
|
259 | _hg_resolve() { | |
260 | local rstate rpath |
|
260 | local rstate rpath | |
261 |
|
261 | |||
262 | [[ -d $PREFIX ]] || PREFIX=$PREFIX:h |
|
262 | [[ -d $PREFIX ]] || PREFIX=$PREFIX:h | |
263 |
|
263 | |||
264 | _hg_cmd resolve -l ./$PREFIX | while read rstate rpath |
|
264 | _hg_cmd resolve -l ./$PREFIX | while read rstate rpath | |
265 | do |
|
265 | do | |
266 | [[ $rstate == 'R' ]] && resolved_files+=($rpath) |
|
266 | [[ $rstate == 'R' ]] && resolved_files+=($rpath) | |
267 | [[ $rstate == 'U' ]] && unresolved_files+=($rpath) |
|
267 | [[ $rstate == 'U' ]] && unresolved_files+=($rpath) | |
268 | done |
|
268 | done | |
269 | } |
|
269 | } | |
270 |
|
270 | |||
271 | _hg_resolved() { |
|
271 | _hg_resolved() { | |
272 | typeset -a resolved_files unresolved_files |
|
272 | typeset -a resolved_files unresolved_files | |
273 | _hg_resolve |
|
273 | _hg_resolve | |
274 | _wanted files expl 'resolved files' _multi_parts / resolved_files |
|
274 | _wanted files expl 'resolved files' _multi_parts / resolved_files | |
275 | } |
|
275 | } | |
276 |
|
276 | |||
277 | _hg_unresolved() { |
|
277 | _hg_unresolved() { | |
278 | typeset -a resolved_files unresolved_files |
|
278 | typeset -a resolved_files unresolved_files | |
279 | _hg_resolve |
|
279 | _hg_resolve | |
280 | _wanted files expl 'unresolved files' _multi_parts / unresolved_files |
|
280 | _wanted files expl 'unresolved files' _multi_parts / unresolved_files | |
281 | } |
|
281 | } | |
282 |
|
282 | |||
283 | _hg_config() { |
|
283 | _hg_config() { | |
284 | typeset -a items |
|
284 | typeset -a items | |
285 | items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*}) |
|
285 | items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*}) | |
286 | (( $#items )) && _describe -t config 'config item' items |
|
286 | (( $#items )) && _describe -t config 'config item' items | |
287 | } |
|
287 | } | |
288 |
|
288 | |||
289 | _hg_addremove() { |
|
289 | _hg_addremove() { | |
290 | _alternative 'files:unknown files:_hg_unknown' \ |
|
290 | _alternative 'files:unknown files:_hg_unknown' \ | |
291 | 'files:missing files:_hg_missing' |
|
291 | 'files:missing files:_hg_missing' | |
292 | } |
|
292 | } | |
293 |
|
293 | |||
294 | _hg_ssh_urls() { |
|
294 | _hg_ssh_urls() { | |
295 | if [[ -prefix */ ]] |
|
295 | if [[ -prefix */ ]] | |
296 | then |
|
296 | then | |
297 | if zstyle -T ":completion:${curcontext}:files" remote-access |
|
297 | if zstyle -T ":completion:${curcontext}:files" remote-access | |
298 | then |
|
298 | then | |
299 | local host=${PREFIX%%/*} |
|
299 | local host=${PREFIX%%/*} | |
300 | typeset -a remdirs |
|
300 | typeset -a remdirs | |
301 | compset -p $(( $#host + 1 )) |
|
301 | compset -p $(( $#host + 1 )) | |
302 | local rempath=${(M)PREFIX##*/} |
|
302 | local rempath=${(M)PREFIX##*/} | |
303 | local cacheid="hg:${host}-${rempath//\//_}" |
|
303 | local cacheid="hg:${host}-${rempath//\//_}" | |
304 | cacheid=${cacheid%[-_]} |
|
304 | cacheid=${cacheid%[-_]} | |
305 | compset -P '*/' |
|
305 | compset -P '*/' | |
306 | if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" |
|
306 | if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" | |
307 | then |
|
307 | then | |
308 | remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/}) |
|
308 | remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/}) | |
309 | _store_cache "$cacheid" remdirs |
|
309 | _store_cache "$cacheid" remdirs | |
310 | fi |
|
310 | fi | |
311 | _describe -t directories 'remote directory' remdirs -S/ |
|
311 | _describe -t directories 'remote directory' remdirs -S/ | |
312 | else |
|
312 | else | |
313 | _message 'remote directory' |
|
313 | _message 'remote directory' | |
314 | fi |
|
314 | fi | |
315 | else |
|
315 | else | |
316 | if compset -P '*@' |
|
316 | if compset -P '*@' | |
317 | then |
|
317 | then | |
318 | _hosts -S/ |
|
318 | _hosts -S/ | |
319 | else |
|
319 | else | |
320 | _alternative 'hosts:remote host name:_hosts -S/' \ |
|
320 | _alternative 'hosts:remote host name:_hosts -S/' \ | |
321 | 'users:user:_users -S@' |
|
321 | 'users:user:_users -S@' | |
322 | fi |
|
322 | fi | |
323 | fi |
|
323 | fi | |
324 | } |
|
324 | } | |
325 |
|
325 | |||
326 | _hg_urls() { |
|
326 | _hg_urls() { | |
327 | if compset -P bundle:// |
|
327 | if compset -P bundle:// | |
328 | then |
|
328 | then | |
329 | _files |
|
329 | _files | |
330 | elif compset -P ssh:// |
|
330 | elif compset -P ssh:// | |
331 | then |
|
331 | then | |
332 | _hg_ssh_urls |
|
332 | _hg_ssh_urls | |
333 | elif [[ -prefix *: ]] |
|
333 | elif [[ -prefix *: ]] | |
334 | then |
|
334 | then | |
335 | _urls |
|
335 | _urls | |
336 | else |
|
336 | else | |
337 | local expl |
|
337 | local expl | |
338 | compset -S '[^:]*' |
|
338 | compset -S '[^:]*' | |
339 | _wanted url-schemas expl 'URL schema' compadd -S '' - \ |
|
339 | _wanted url-schemas expl 'URL schema' compadd -S '' - \ | |
340 | http:// https:// ssh:// bundle:// |
|
340 | http:// https:// ssh:// bundle:// | |
341 | fi |
|
341 | fi | |
342 | } |
|
342 | } | |
343 |
|
343 | |||
344 | _hg_paths() { |
|
344 | _hg_paths() { | |
345 | typeset -a paths pnames |
|
345 | typeset -a paths pnames | |
346 | _hg_cmd paths | while read -A pnames |
|
346 | _hg_cmd paths | while read -A pnames | |
347 | do |
|
347 | do | |
348 | paths+=($pnames[1]) |
|
348 | paths+=($pnames[1]) | |
349 | done |
|
349 | done | |
350 | (( $#paths )) && _describe -t path-aliases 'repository alias' paths |
|
350 | (( $#paths )) && _describe -t path-aliases 'repository alias' paths | |
351 | } |
|
351 | } | |
352 |
|
352 | |||
353 | _hg_remote() { |
|
353 | _hg_remote() { | |
354 | _alternative 'path-aliases:repository alias:_hg_paths' \ |
|
354 | _alternative 'path-aliases:repository alias:_hg_paths' \ | |
355 | 'directories:directory:_files -/' \ |
|
355 | 'directories:directory:_files -/' \ | |
356 | 'urls:URL:_hg_urls' |
|
356 | 'urls:URL:_hg_urls' | |
357 | } |
|
357 | } | |
358 |
|
358 | |||
359 | _hg_clone_dest() { |
|
359 | _hg_clone_dest() { | |
360 | _alternative 'directories:directory:_files -/' \ |
|
360 | _alternative 'directories:directory:_files -/' \ | |
361 | 'urls:URL:_hg_urls' |
|
361 | 'urls:URL:_hg_urls' | |
362 | } |
|
362 | } | |
363 |
|
363 | |||
364 | _hg_add_help_topics=( |
|
364 | _hg_add_help_topics=( | |
365 | config dates diffs environment extensions filesets glossary hgignore hgweb |
|
365 | config dates diffs environment extensions filesets glossary hgignore hgweb | |
366 | merge-tools multirevs obsolescence patterns phases revisions revsets |
|
366 | merge-tools multirevs obsolescence patterns phases revisions revsets | |
367 | subrepos templating urls |
|
367 | subrepos templating urls | |
368 | ) |
|
368 | ) | |
369 |
|
369 | |||
370 | _hg_help_topics() { |
|
370 | _hg_help_topics() { | |
371 | local topics |
|
371 | local topics | |
372 | (( $#_hg_cmd_list )) || _hg_get_commands |
|
372 | (( $#_hg_cmd_list )) || _hg_get_commands | |
373 | topics=($_hg_cmd_list $_hg_add_help_topics) |
|
373 | topics=($_hg_cmd_list $_hg_add_help_topics) | |
374 | _describe -t help_topics 'help topics' topics |
|
374 | _describe -t help_topics 'help topics' topics | |
375 | } |
|
375 | } | |
376 |
|
376 | |||
377 | # Common options |
|
377 | # Common options | |
378 | _hg_global_opts=( |
|
378 | _hg_global_opts=( | |
379 | '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' |
|
379 | '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' | |
380 | '--cwd[change working directory]:new working directory:_files -/' |
|
380 | '--cwd[change working directory]:new working directory:_files -/' | |
381 | '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]' |
|
381 | '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]' | |
382 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' |
|
382 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' | |
383 | '*--config[set/override config option]:defined config items:_hg_config' |
|
383 | '*--config[set/override config option]:defined config items:_hg_config' | |
384 | '(--quiet -q)'{-q,--quiet}'[suppress output]' |
|
384 | '(--quiet -q)'{-q,--quiet}'[suppress output]' | |
385 | '(--help -h)'{-h,--help}'[display help and exit]' |
|
385 | '(--help -h)'{-h,--help}'[display help and exit]' | |
386 | '--debug[debug mode]' |
|
386 | '--debug[debug mode]' | |
387 | '--debugger[start debugger]' |
|
387 | '--debugger[start debugger]' | |
388 | '--encoding[set the charset encoding]' |
|
388 | '--encoding[set the charset encoding]' | |
389 | '--encodingmode[set the charset encoding mode]' |
|
389 | '--encodingmode[set the charset encoding mode]' | |
390 | '--lsprof[print improved command execution profile]' |
|
390 | '--lsprof[print improved command execution profile]' | |
391 | '--traceback[print traceback on exception]' |
|
391 | '--traceback[print traceback on exception]' | |
392 | '--time[time how long the command takes]' |
|
392 | '--time[time how long the command takes]' | |
393 | '--profile[profile]' |
|
393 | '--profile[profile]' | |
394 | '--version[output version information and exit]' |
|
394 | '--version[output version information and exit]' | |
395 | ) |
|
395 | ) | |
396 |
|
396 | |||
397 | _hg_pat_opts=( |
|
397 | _hg_pat_opts=( | |
398 | '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' |
|
398 | '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' | |
399 | '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') |
|
399 | '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') | |
400 |
|
400 | |||
401 | _hg_diff_opts=( |
|
401 | _hg_diff_opts=( | |
402 | '(--text -a)'{-a,--text}'[treat all files as text]' |
|
402 | '(--text -a)'{-a,--text}'[treat all files as text]' | |
403 | '(--git -g)'{-g,--git}'[use git extended diff format]' |
|
403 | '(--git -g)'{-g,--git}'[use git extended diff format]' | |
404 | "--nodates[omit dates from diff headers]") |
|
404 | "--nodates[omit dates from diff headers]") | |
405 |
|
405 | |||
406 | _hg_dryrun_opts=( |
|
406 | _hg_dryrun_opts=( | |
407 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]') |
|
407 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]') | |
408 |
|
408 | |||
409 | _hg_style_opts=( |
|
409 | _hg_style_opts=( | |
410 | '--style[display using template map file]:' |
|
410 | '--style[display using template map file]:' | |
411 | '--template[display with template]:') |
|
411 | '--template[display with template]:') | |
412 |
|
412 | |||
413 | _hg_commit_opts=( |
|
413 | _hg_commit_opts=( | |
414 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' |
|
414 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' | |
415 | '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:' |
|
415 | '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:' | |
416 | '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files') |
|
416 | '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files') | |
417 |
|
417 | |||
418 | _hg_remote_opts=( |
|
418 | _hg_remote_opts=( | |
419 | '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' |
|
419 | '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' | |
420 | '--remotecmd[specify hg command to run on the remote side]:') |
|
420 | '--remotecmd[specify hg command to run on the remote side]:') | |
421 |
|
421 | |||
422 | _hg_cmd() { |
|
422 | _hg_cmd() { | |
423 | _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null |
|
423 | _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null | |
424 | } |
|
424 | } | |
425 |
|
425 | |||
426 | _hg_cmd_add() { |
|
426 | _hg_cmd_add() { | |
427 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
427 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
428 | '*:unknown files:_hg_unknown' |
|
428 | '*:unknown files:_hg_unknown' | |
429 | } |
|
429 | } | |
430 |
|
430 | |||
431 | _hg_cmd_addremove() { |
|
431 | _hg_cmd_addremove() { | |
432 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
432 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
433 | '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \ |
|
433 | '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \ | |
434 | '*:unknown or missing files:_hg_addremove' |
|
434 | '*:unknown or missing files:_hg_addremove' | |
435 | } |
|
435 | } | |
436 |
|
436 | |||
437 | _hg_cmd_annotate() { |
|
437 | _hg_cmd_annotate() { | |
438 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
438 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
439 | '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \ |
|
439 | '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \ | |
440 | '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ |
|
440 | '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ | |
441 | '(--text -a)'{-a,--text}'[treat all files as text]' \ |
|
441 | '(--text -a)'{-a,--text}'[treat all files as text]' \ | |
442 | '(--user -u)'{-u,--user}'[list the author]' \ |
|
442 | '(--user -u)'{-u,--user}'[list the author]' \ | |
443 | '(--date -d)'{-d,--date}'[list the date]' \ |
|
443 | '(--date -d)'{-d,--date}'[list the date]' \ | |
444 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ |
|
444 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ | |
445 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ |
|
445 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ | |
446 | '*:files:_hg_files' |
|
446 | '*:files:_hg_files' | |
447 | } |
|
447 | } | |
448 |
|
448 | |||
449 | _hg_cmd_archive() { |
|
449 | _hg_cmd_archive() { | |
450 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
450 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
451 | '--no-decode[do not pass files through decoders]' \ |
|
451 | '--no-decode[do not pass files through decoders]' \ | |
452 | '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ |
|
452 | '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ | |
453 | '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \ |
|
453 | '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \ | |
454 | '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ |
|
454 | '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ | |
455 | '*:destination:_files' |
|
455 | '*:destination:_files' | |
456 | } |
|
456 | } | |
457 |
|
457 | |||
458 | _hg_cmd_backout() { |
|
458 | _hg_cmd_backout() { | |
459 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
459 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
460 | '--merge[merge with old dirstate parent after backout]' \ |
|
460 | '--merge[merge with old dirstate parent after backout]' \ | |
461 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
461 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
462 | '--parent[parent to choose when backing out merge]' \ |
|
462 | '--parent[parent to choose when backing out merge]' \ | |
463 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
463 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
464 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \ |
|
464 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \ | |
465 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
465 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
466 | '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' |
|
466 | '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' | |
467 | } |
|
467 | } | |
468 |
|
468 | |||
469 | _hg_cmd_bisect() { |
|
469 | _hg_cmd_bisect() { | |
470 | _arguments -s -w : $_hg_global_opts \ |
|
470 | _arguments -s -w : $_hg_global_opts \ | |
471 | '(-)'{-r,--reset}'[reset bisect state]' \ |
|
471 | '(-)'{-r,--reset}'[reset bisect state]' \ | |
472 | '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \ |
|
472 | '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \ | |
473 | '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \ |
|
473 | '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \ | |
474 | '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \ |
|
474 | '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \ | |
475 | '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \ |
|
475 | '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \ | |
476 | '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]' |
|
476 | '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]' | |
477 | } |
|
477 | } | |
478 |
|
478 | |||
479 | _hg_cmd_bookmarks() { |
|
479 | _hg_cmd_bookmarks() { | |
480 | _arguments -s -w : $_hg_global_opts \ |
|
480 | _arguments -s -w : $_hg_global_opts \ | |
481 | '(--force -f)'{-f,--force}'[force]' \ |
|
481 | '(--force -f)'{-f,--force}'[force]' \ | |
482 | '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \ |
|
482 | '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \ | |
483 | '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \ |
|
483 | '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \ | |
484 | '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \ |
|
484 | '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \ | |
485 | ':bookmark:_hg_bookmarks' |
|
485 | ':bookmark:_hg_bookmarks' | |
486 | } |
|
486 | } | |
487 |
|
487 | |||
488 | _hg_cmd_branch() { |
|
488 | _hg_cmd_branch() { | |
489 | _arguments -s -w : $_hg_global_opts \ |
|
489 | _arguments -s -w : $_hg_global_opts \ | |
490 | '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \ |
|
490 | '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \ | |
491 | '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]' |
|
491 | '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]' | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | _hg_cmd_branches() { |
|
494 | _hg_cmd_branches() { | |
495 | _arguments -s -w : $_hg_global_opts \ |
|
495 | _arguments -s -w : $_hg_global_opts \ | |
496 | '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]' |
|
496 | '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]' | |
497 | } |
|
497 | } | |
498 |
|
498 | |||
499 | _hg_cmd_bundle() { |
|
499 | _hg_cmd_bundle() { | |
500 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
500 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
501 | '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ |
|
501 | '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ | |
502 | '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \ |
|
502 | '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \ | |
503 | ':output file:_files' \ |
|
503 | ':output file:_files' \ | |
504 | ':destination repository:_files -/' |
|
504 | ':destination repository:_files -/' | |
505 | } |
|
505 | } | |
506 |
|
506 | |||
507 | _hg_cmd_cat() { |
|
507 | _hg_cmd_cat() { | |
508 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
508 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
509 | '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ |
|
509 | '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ | |
510 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \ |
|
510 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \ | |
511 | '*:file:_hg_files' |
|
511 | '*:file:_hg_files' | |
512 | } |
|
512 | } | |
513 |
|
513 | |||
514 | _hg_cmd_clone() { |
|
514 | _hg_cmd_clone() { | |
515 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
515 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
516 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ |
|
516 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ | |
517 | '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \ |
|
517 | '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \ | |
518 | '--uncompressed[use uncompressed transfer (fast over LAN)]' \ |
|
518 | '--uncompressed[use uncompressed transfer (fast over LAN)]' \ | |
519 | ':source repository:_hg_remote' \ |
|
519 | ':source repository:_hg_remote' \ | |
520 | ':destination:_hg_clone_dest' |
|
520 | ':destination:_hg_clone_dest' | |
521 | } |
|
521 | } | |
522 |
|
522 | |||
523 | _hg_cmd_commit() { |
|
523 | _hg_cmd_commit() { | |
524 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
524 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
525 | '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ |
|
525 | '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ | |
526 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
526 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
527 | '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \ |
|
527 | '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \ | |
528 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
528 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
529 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
529 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
530 | '--amend[amend the parent of the working dir]' \ |
|
530 | '--amend[amend the parent of the working dir]' \ | |
531 | '*:file:_hg_files' |
|
531 | '*:file:_hg_files' | |
532 | } |
|
532 | } | |
533 |
|
533 | |||
534 | _hg_cmd_copy() { |
|
534 | _hg_cmd_copy() { | |
535 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
535 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
536 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ |
|
536 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ | |
537 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
537 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ | |
538 | '*:file:_hg_files' |
|
538 | '*:file:_hg_files' | |
539 | } |
|
539 | } | |
540 |
|
540 | |||
541 | _hg_cmd_diff() { |
|
541 | _hg_cmd_diff() { | |
542 | typeset -A opt_args |
|
542 | typeset -A opt_args | |
543 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ |
|
543 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ | |
544 | '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ |
|
544 | '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ | |
545 | '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ |
|
545 | '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ | |
546 | '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ |
|
546 | '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ | |
547 | '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ |
|
547 | '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ | |
548 | '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ |
|
548 | '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ | |
549 | '*:file:->diff_files' |
|
549 | '*:file:->diff_files' | |
550 |
|
550 | |||
551 | if [[ $state == 'diff_files' ]] |
|
551 | if [[ $state == 'diff_files' ]] | |
552 | then |
|
552 | then | |
553 | if [[ -n $opt_args[-r] ]] |
|
553 | if [[ -n $opt_args[-r] ]] | |
554 | then |
|
554 | then | |
555 | _hg_files |
|
555 | _hg_files | |
556 | else |
|
556 | else | |
557 | _hg_modified |
|
557 | _hg_modified | |
558 | fi |
|
558 | fi | |
559 | fi |
|
559 | fi | |
560 | } |
|
560 | } | |
561 |
|
561 | |||
562 | _hg_cmd_export() { |
|
562 | _hg_cmd_export() { | |
563 | _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ |
|
563 | _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ | |
564 | '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ |
|
564 | '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ | |
565 | '--switch-parent[diff against the second parent]' \ |
|
565 | '--switch-parent[diff against the second parent]' \ | |
566 | '*:revision:_hg_labels' |
|
566 | '*:revision:_hg_labels' | |
567 | } |
|
567 | } | |
568 |
|
568 | |||
|
569 | _hg_cmd_forget() { | |||
|
570 | _arguments -s -w : $_hg_global_opts \ | |||
|
571 | '*:file:_hg_files' | |||
|
572 | } | |||
|
573 | ||||
569 | _hg_cmd_graft() { |
|
574 | _hg_cmd_graft() { | |
570 | _arguments -s -w : $_hg_global_opts \ |
|
575 | _arguments -s -w : $_hg_global_opts \ | |
571 | '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \ |
|
576 | '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \ | |
572 | '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ |
|
577 | '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ | |
573 | '--log[append graft info to log message]' \ |
|
578 | '--log[append graft info to log message]' \ | |
574 | '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]' \ |
|
579 | '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]' \ | |
575 | '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]' \ |
|
580 | '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]' \ | |
576 | '(--date -d)'{-d,--date}'[record the specified date as commit date]' \ |
|
581 | '(--date -d)'{-d,--date}'[record the specified date as commit date]' \ | |
577 | '(--user -u)'{-u,--user}'[record the specified user as committer]' \ |
|
582 | '(--user -u)'{-u,--user}'[record the specified user as committer]' \ | |
578 | '(--tool -t)'{-t,--tool}'[specify merge tool]' \ |
|
583 | '(--tool -t)'{-t,--tool}'[specify merge tool]' \ | |
579 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]' \ |
|
584 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]' \ | |
580 | '*:revision:_hg_labels' |
|
585 | '*:revision:_hg_labels' | |
581 | } |
|
586 | } | |
582 |
|
587 | |||
583 | _hg_cmd_grep() { |
|
588 | _hg_cmd_grep() { | |
584 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
589 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
585 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ |
|
590 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ | |
586 | '--all[print all revisions with matches]' \ |
|
591 | '--all[print all revisions with matches]' \ | |
587 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ |
|
592 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ | |
588 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ |
|
593 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ | |
589 | '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ |
|
594 | '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ | |
590 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ |
|
595 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ | |
591 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ |
|
596 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ | |
592 | '(--user -u)'{-u,--user}'[print user who committed change]' \ |
|
597 | '(--user -u)'{-u,--user}'[print user who committed change]' \ | |
593 | '1:search pattern:' \ |
|
598 | '1:search pattern:' \ | |
594 | '*:files:_hg_files' |
|
599 | '*:files:_hg_files' | |
595 | } |
|
600 | } | |
596 |
|
601 | |||
597 | _hg_cmd_heads() { |
|
602 | _hg_cmd_heads() { | |
598 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
603 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
599 | '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels' |
|
604 | '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels' | |
600 | } |
|
605 | } | |
601 |
|
606 | |||
602 | _hg_cmd_help() { |
|
607 | _hg_cmd_help() { | |
603 | _arguments -s -w : $_hg_global_opts \ |
|
608 | _arguments -s -w : $_hg_global_opts \ | |
604 | '*:mercurial help topic:_hg_help_topics' |
|
609 | '*:mercurial help topic:_hg_help_topics' | |
605 | } |
|
610 | } | |
606 |
|
611 | |||
607 | _hg_cmd_identify() { |
|
612 | _hg_cmd_identify() { | |
608 | _arguments -s -w : $_hg_global_opts \ |
|
613 | _arguments -s -w : $_hg_global_opts \ | |
609 | '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \ |
|
614 | '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \ | |
610 | '(--num -n)'{-n+,--num}'[show local revision number]' \ |
|
615 | '(--num -n)'{-n+,--num}'[show local revision number]' \ | |
611 | '(--id -i)'{-i+,--id}'[show global revision id]' \ |
|
616 | '(--id -i)'{-i+,--id}'[show global revision id]' \ | |
612 | '(--branch -b)'{-b+,--branch}'[show branch]' \ |
|
617 | '(--branch -b)'{-b+,--branch}'[show branch]' \ | |
613 | '(--tags -t)'{-t+,--tags}'[show tags]' |
|
618 | '(--tags -t)'{-t+,--tags}'[show tags]' | |
614 | } |
|
619 | } | |
615 |
|
620 | |||
616 | _hg_cmd_import() { |
|
621 | _hg_cmd_import() { | |
617 | _arguments -s -w : $_hg_global_opts \ |
|
622 | _arguments -s -w : $_hg_global_opts \ | |
618 | '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \ |
|
623 | '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \ | |
619 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
624 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
620 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ |
|
625 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ | |
621 | '--bypass[apply patch without touching the working directory]' \ |
|
626 | '--bypass[apply patch without touching the working directory]' \ | |
622 | '*:patch:_files' |
|
627 | '*:patch:_files' | |
623 | } |
|
628 | } | |
624 |
|
629 | |||
625 | _hg_cmd_incoming() { |
|
630 | _hg_cmd_incoming() { | |
626 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ |
|
631 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ | |
627 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ |
|
632 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ | |
628 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
633 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ | |
629 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
634 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
630 | '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \ |
|
635 | '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \ | |
631 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
636 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ | |
632 | '--bundle[file to store the bundles into]:bundle file:_files' \ |
|
637 | '--bundle[file to store the bundles into]:bundle file:_files' \ | |
633 | ':source:_hg_remote' |
|
638 | ':source:_hg_remote' | |
634 | } |
|
639 | } | |
635 |
|
640 | |||
636 | _hg_cmd_init() { |
|
641 | _hg_cmd_init() { | |
637 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
642 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
638 | ':dir:_files -/' |
|
643 | ':dir:_files -/' | |
639 | } |
|
644 | } | |
640 |
|
645 | |||
641 | _hg_cmd_locate() { |
|
646 | _hg_cmd_locate() { | |
642 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
647 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
643 | '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \ |
|
648 | '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \ | |
644 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
649 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ | |
645 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ |
|
650 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ | |
646 | '*:search pattern:_hg_files' |
|
651 | '*:search pattern:_hg_files' | |
647 | } |
|
652 | } | |
648 |
|
653 | |||
649 | _hg_cmd_log() { |
|
654 | _hg_cmd_log() { | |
650 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ |
|
655 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ | |
651 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ |
|
656 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ | |
652 | '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ |
|
657 | '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ | |
653 | '(--copies -C)'{-C,--copies}'[show copied files]' \ |
|
658 | '(--copies -C)'{-C,--copies}'[show copied files]' \ | |
654 | '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ |
|
659 | '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ | |
655 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
|
660 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | |
656 | '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \ |
|
661 | '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \ | |
657 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ |
|
662 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ | |
658 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ |
|
663 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ | |
659 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
664 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
660 | '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \ |
|
665 | '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \ | |
661 | '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \ |
|
666 | '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \ | |
662 | '*:files:_hg_files' |
|
667 | '*:files:_hg_files' | |
663 | } |
|
668 | } | |
664 |
|
669 | |||
665 | _hg_cmd_manifest() { |
|
670 | _hg_cmd_manifest() { | |
666 | _arguments -s -w : $_hg_global_opts \ |
|
671 | _arguments -s -w : $_hg_global_opts \ | |
667 | '--all[list files from all revisions]' \ |
|
672 | '--all[list files from all revisions]' \ | |
668 | ':revision:_hg_labels' |
|
673 | ':revision:_hg_labels' | |
669 | } |
|
674 | } | |
670 |
|
675 | |||
671 | _hg_cmd_merge() { |
|
676 | _hg_cmd_merge() { | |
672 | _arguments -s -w : $_hg_global_opts \ |
|
677 | _arguments -s -w : $_hg_global_opts \ | |
673 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ |
|
678 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ | |
674 | '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \ |
|
679 | '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \ | |
675 | '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \ |
|
680 | '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \ | |
676 | '(--tool -t)'{-t,--tool}'[specify merge tool]' \ |
|
681 | '(--tool -t)'{-t,--tool}'[specify merge tool]' \ | |
677 | ':revision:_hg_mergerevs' |
|
682 | ':revision:_hg_mergerevs' | |
678 | } |
|
683 | } | |
679 |
|
684 | |||
680 | _hg_cmd_outgoing() { |
|
685 | _hg_cmd_outgoing() { | |
681 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ |
|
686 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ | |
682 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ |
|
687 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ | |
683 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
688 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ | |
684 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
689 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
685 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ |
|
690 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ | |
686 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
691 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ | |
687 | ':destination:_hg_remote' |
|
692 | ':destination:_hg_remote' | |
688 | } |
|
693 | } | |
689 |
|
694 | |||
690 | _hg_cmd_parents() { |
|
695 | _hg_cmd_parents() { | |
691 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
696 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
692 | '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \ |
|
697 | '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \ | |
693 | ':last modified file:_hg_files' |
|
698 | ':last modified file:_hg_files' | |
694 | } |
|
699 | } | |
695 |
|
700 | |||
696 | _hg_cmd_paths() { |
|
701 | _hg_cmd_paths() { | |
697 | _arguments -s -w : $_hg_global_opts \ |
|
702 | _arguments -s -w : $_hg_global_opts \ | |
698 | ':path:_hg_paths' |
|
703 | ':path:_hg_paths' | |
699 | } |
|
704 | } | |
700 |
|
705 | |||
701 | _hg_cmd_phase() { |
|
706 | _hg_cmd_phase() { | |
702 | _arguments -s -w : $_hg_global_opts \ |
|
707 | _arguments -s -w : $_hg_global_opts \ | |
703 | '(--public -p)'{-p,--public}'[set changeset phase to public]' \ |
|
708 | '(--public -p)'{-p,--public}'[set changeset phase to public]' \ | |
704 | '(--draft -d)'{-d,--draft}'[set changeset phase to draft]' \ |
|
709 | '(--draft -d)'{-d,--draft}'[set changeset phase to draft]' \ | |
705 | '(--secret -s)'{-s,--secret}'[set changeset phase to secret]' \ |
|
710 | '(--secret -s)'{-s,--secret}'[set changeset phase to secret]' \ | |
706 | '(--force -f)'{-f,--force}'[allow to move boundary backward]' \ |
|
711 | '(--force -f)'{-f,--force}'[allow to move boundary backward]' \ | |
707 | '(--rev -r)'{-r+,--rev}'[target revision]:revision:_hg_labels' \ |
|
712 | '(--rev -r)'{-r+,--rev}'[target revision]:revision:_hg_labels' \ | |
708 | ':revision:_hg_labels' |
|
713 | ':revision:_hg_labels' | |
709 | } |
|
714 | } | |
710 |
|
715 | |||
711 | _hg_cmd_pull() { |
|
716 | _hg_cmd_pull() { | |
712 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
717 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
713 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
718 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ | |
714 | '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ |
|
719 | '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ | |
715 | '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \ |
|
720 | '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \ | |
716 | ':source:_hg_remote' |
|
721 | ':source:_hg_remote' | |
717 | } |
|
722 | } | |
718 |
|
723 | |||
719 | _hg_cmd_push() { |
|
724 | _hg_cmd_push() { | |
720 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
725 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
721 | '(--force -f)'{-f,--force}'[force push]' \ |
|
726 | '(--force -f)'{-f,--force}'[force push]' \ | |
722 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \ |
|
727 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \ | |
723 | ':destination:_hg_remote' |
|
728 | ':destination:_hg_remote' | |
724 | } |
|
729 | } | |
725 |
|
730 | |||
726 | _hg_cmd_remove() { |
|
731 | _hg_cmd_remove() { | |
727 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
732 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
728 | '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ |
|
733 | '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ | |
729 | '(--force -f)'{-f,--force}'[remove file even if modified]' \ |
|
734 | '(--force -f)'{-f,--force}'[remove file even if modified]' \ | |
730 | '*:file:_hg_files' |
|
735 | '*:file:_hg_files' | |
731 | } |
|
736 | } | |
732 |
|
737 | |||
733 | _hg_cmd_rename() { |
|
738 | _hg_cmd_rename() { | |
734 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
739 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
735 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ |
|
740 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ | |
736 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
741 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ | |
737 | '*:file:_hg_files' |
|
742 | '*:file:_hg_files' | |
738 | } |
|
743 | } | |
739 |
|
744 | |||
740 | _hg_cmd_resolve() { |
|
745 | _hg_cmd_resolve() { | |
741 | local context state line |
|
746 | local context state line | |
742 | typeset -A opt_args |
|
747 | typeset -A opt_args | |
743 |
|
748 | |||
744 | _arguments -s -w : $_hg_global_opts \ |
|
749 | _arguments -s -w : $_hg_global_opts \ | |
745 | '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \ |
|
750 | '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \ | |
746 | '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \ |
|
751 | '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \ | |
747 | '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \ |
|
752 | '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \ | |
748 | '*:file:_hg_unresolved' |
|
753 | '*:file:_hg_unresolved' | |
749 |
|
754 | |||
750 | if [[ $state == 'resolve_files' ]] |
|
755 | if [[ $state == 'resolve_files' ]] | |
751 | then |
|
756 | then | |
752 | _alternative 'files:resolved files:_hg_resolved' \ |
|
757 | _alternative 'files:resolved files:_hg_resolved' \ | |
753 | 'files:unresolved files:_hg_unresolved' |
|
758 | 'files:unresolved files:_hg_unresolved' | |
754 | fi |
|
759 | fi | |
755 | } |
|
760 | } | |
756 |
|
761 | |||
757 | _hg_cmd_revert() { |
|
762 | _hg_cmd_revert() { | |
758 | local context state line |
|
763 | local context state line | |
759 | typeset -A opt_args |
|
764 | typeset -A opt_args | |
760 |
|
765 | |||
761 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
766 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
762 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ |
|
767 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ | |
763 | '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \ |
|
768 | '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \ | |
764 | '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \ |
|
769 | '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \ | |
765 | '*:file:->diff_files' |
|
770 | '*:file:->diff_files' | |
766 |
|
771 | |||
767 | if [[ $state == 'diff_files' ]] |
|
772 | if [[ $state == 'diff_files' ]] | |
768 | then |
|
773 | then | |
769 | if [[ -n $opt_args[-r] ]] |
|
774 | if [[ -n $opt_args[-r] ]] | |
770 | then |
|
775 | then | |
771 | _hg_files |
|
776 | _hg_files | |
772 | else |
|
777 | else | |
773 | typeset -a status_files |
|
778 | typeset -a status_files | |
774 | _hg_status mard |
|
779 | _hg_status mard | |
775 | _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files |
|
780 | _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files | |
776 | fi |
|
781 | fi | |
777 | fi |
|
782 | fi | |
778 | } |
|
783 | } | |
779 |
|
784 | |||
|
785 | _hg_cmd_rollback() { | |||
|
786 | _arguments -s -w : $_hg_global_opts $_hg_dryrun_opts \ | |||
|
787 | '(--force -f)'{-f,--force}'[ignore safety measures]' \ | |||
|
788 | } | |||
|
789 | ||||
780 | _hg_cmd_serve() { |
|
790 | _hg_cmd_serve() { | |
781 | _arguments -s -w : $_hg_global_opts \ |
|
791 | _arguments -s -w : $_hg_global_opts \ | |
782 | '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \ |
|
792 | '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \ | |
783 | '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \ |
|
793 | '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \ | |
784 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ |
|
794 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ | |
785 | '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ |
|
795 | '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ | |
786 | '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ |
|
796 | '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ | |
787 | '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \ |
|
797 | '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \ | |
788 | '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ |
|
798 | '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ | |
789 | '--style[web template style]:style' \ |
|
799 | '--style[web template style]:style' \ | |
790 | '--stdio[for remote clients]' \ |
|
800 | '--stdio[for remote clients]' \ | |
791 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' |
|
801 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' | |
792 | } |
|
802 | } | |
793 |
|
803 | |||
794 | _hg_cmd_showconfig() { |
|
804 | _hg_cmd_showconfig() { | |
795 | _arguments -s -w : $_hg_global_opts \ |
|
805 | _arguments -s -w : $_hg_global_opts \ | |
796 | '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \ |
|
806 | '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \ | |
797 | ':config item:_hg_config' |
|
807 | ':config item:_hg_config' | |
798 | } |
|
808 | } | |
799 |
|
809 | |||
800 | _hg_cmd_status() { |
|
810 | _hg_cmd_status() { | |
801 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
811 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
802 | '(--all -A)'{-A,--all}'[show status of all files]' \ |
|
812 | '(--all -A)'{-A,--all}'[show status of all files]' \ | |
803 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ |
|
813 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ | |
804 | '(--added -a)'{-a,--added}'[show only added files]' \ |
|
814 | '(--added -a)'{-a,--added}'[show only added files]' \ | |
805 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ |
|
815 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ | |
806 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ |
|
816 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ | |
807 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ |
|
817 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ | |
808 | '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ |
|
818 | '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ | |
809 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ |
|
819 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ | |
810 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ |
|
820 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ | |
811 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ |
|
821 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ | |
812 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
822 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ | |
813 | '--rev[show difference from revision]:revision:_hg_labels' \ |
|
823 | '--rev[show difference from revision]:revision:_hg_labels' \ | |
814 | '*:files:_files' |
|
824 | '*:files:_files' | |
815 | } |
|
825 | } | |
816 |
|
826 | |||
817 | _hg_cmd_summary() { |
|
827 | _hg_cmd_summary() { | |
818 | _arguments -s -w : $_hg_global_opts \ |
|
828 | _arguments -s -w : $_hg_global_opts \ | |
819 | '--remote[check for push and pull]' |
|
829 | '--remote[check for push and pull]' | |
820 | } |
|
830 | } | |
821 |
|
831 | |||
822 | _hg_cmd_tag() { |
|
832 | _hg_cmd_tag() { | |
823 | _arguments -s -w : $_hg_global_opts \ |
|
833 | _arguments -s -w : $_hg_global_opts \ | |
824 | '(--local -l)'{-l,--local}'[make the tag local]' \ |
|
834 | '(--local -l)'{-l,--local}'[make the tag local]' \ | |
825 | '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ |
|
835 | '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ | |
826 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
836 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
827 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
837 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
828 | '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \ |
|
838 | '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \ | |
829 | ':tag name:' |
|
839 | ':tag name:' | |
830 | } |
|
840 | } | |
831 |
|
841 | |||
832 | _hg_cmd_tip() { |
|
842 | _hg_cmd_tip() { | |
833 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
843 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
834 | '(--patch -p)'{-p,--patch}'[show patch]' |
|
844 | '(--patch -p)'{-p,--patch}'[show patch]' | |
835 | } |
|
845 | } | |
836 |
|
846 | |||
837 | _hg_cmd_unbundle() { |
|
847 | _hg_cmd_unbundle() { | |
838 | _arguments -s -w : $_hg_global_opts \ |
|
848 | _arguments -s -w : $_hg_global_opts \ | |
839 | '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ |
|
849 | '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ | |
840 | ':files:_files' |
|
850 | ':files:_files' | |
841 | } |
|
851 | } | |
842 |
|
852 | |||
843 | _hg_cmd_update() { |
|
853 | _hg_cmd_update() { | |
844 | _arguments -s -w : $_hg_global_opts \ |
|
854 | _arguments -s -w : $_hg_global_opts \ | |
845 | '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ |
|
855 | '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ | |
846 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \ |
|
856 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \ | |
847 | ':revision:_hg_labels' |
|
857 | ':revision:_hg_labels' | |
848 | } |
|
858 | } | |
849 |
|
859 | |||
850 | ## extensions ## |
|
860 | ## extensions ## | |
851 |
|
861 | |||
852 | # HGK |
|
862 | # HGK | |
853 | _hg_cmd_view() { |
|
863 | _hg_cmd_view() { | |
854 | _arguments -s -w : $_hg_global_opts \ |
|
864 | _arguments -s -w : $_hg_global_opts \ | |
855 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
|
865 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | |
856 | ':revision range:_hg_tags' |
|
866 | ':revision range:_hg_tags' | |
857 | } |
|
867 | } | |
858 |
|
868 | |||
859 | # MQ |
|
869 | # MQ | |
860 | _hg_qseries() { |
|
870 | _hg_qseries() { | |
861 | typeset -a patches |
|
871 | typeset -a patches | |
862 | patches=(${(f)"$(_hg_cmd qseries)"}) |
|
872 | patches=(${(f)"$(_hg_cmd qseries)"}) | |
863 | (( $#patches )) && _describe -t hg-patches 'patches' patches |
|
873 | (( $#patches )) && _describe -t hg-patches 'patches' patches | |
864 | } |
|
874 | } | |
865 |
|
875 | |||
866 | _hg_qapplied() { |
|
876 | _hg_qapplied() { | |
867 | typeset -a patches |
|
877 | typeset -a patches | |
868 | patches=(${(f)"$(_hg_cmd qapplied)"}) |
|
878 | patches=(${(f)"$(_hg_cmd qapplied)"}) | |
869 | if (( $#patches )) |
|
879 | if (( $#patches )) | |
870 | then |
|
880 | then | |
871 | patches+=(qbase qtip) |
|
881 | patches+=(qbase qtip) | |
872 | _describe -t hg-applied-patches 'applied patches' patches |
|
882 | _describe -t hg-applied-patches 'applied patches' patches | |
873 | fi |
|
883 | fi | |
874 | } |
|
884 | } | |
875 |
|
885 | |||
876 | _hg_qunapplied() { |
|
886 | _hg_qunapplied() { | |
877 | typeset -a patches |
|
887 | typeset -a patches | |
878 | patches=(${(f)"$(_hg_cmd qunapplied)"}) |
|
888 | patches=(${(f)"$(_hg_cmd qunapplied)"}) | |
879 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches |
|
889 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches | |
880 | } |
|
890 | } | |
881 |
|
891 | |||
882 | # unapplied, including guarded patches |
|
892 | # unapplied, including guarded patches | |
883 | _hg_qdeletable() { |
|
893 | _hg_qdeletable() { | |
884 | typeset -a unapplied |
|
894 | typeset -a unapplied | |
885 | unapplied=(${(f)"$(_hg_cmd qseries)"}) |
|
895 | unapplied=(${(f)"$(_hg_cmd qseries)"}) | |
886 | for p in $(_hg_cmd qapplied) |
|
896 | for p in $(_hg_cmd qapplied) | |
887 | do |
|
897 | do | |
888 | unapplied=(${unapplied:#$p}) |
|
898 | unapplied=(${unapplied:#$p}) | |
889 | done |
|
899 | done | |
890 |
|
900 | |||
891 | (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied |
|
901 | (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied | |
892 | } |
|
902 | } | |
893 |
|
903 | |||
894 | _hg_qguards() { |
|
904 | _hg_qguards() { | |
895 | typeset -a guards |
|
905 | typeset -a guards | |
896 | local guard |
|
906 | local guard | |
897 | compset -P "+|-" |
|
907 | compset -P "+|-" | |
898 | _hg_cmd qselect -s | while read guard |
|
908 | _hg_cmd qselect -s | while read guard | |
899 | do |
|
909 | do | |
900 | guards+=(${guard#(+|-)}) |
|
910 | guards+=(${guard#(+|-)}) | |
901 | done |
|
911 | done | |
902 | (( $#guards )) && _describe -t hg-guards 'guards' guards |
|
912 | (( $#guards )) && _describe -t hg-guards 'guards' guards | |
903 | } |
|
913 | } | |
904 |
|
914 | |||
905 | _hg_qseries_opts=( |
|
915 | _hg_qseries_opts=( | |
906 | '(--summary -s)'{-s,--summary}'[print first line of patch header]') |
|
916 | '(--summary -s)'{-s,--summary}'[print first line of patch header]') | |
907 |
|
917 | |||
908 | _hg_cmd_qapplied() { |
|
918 | _hg_cmd_qapplied() { | |
909 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
919 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
910 | } |
|
920 | } | |
911 |
|
921 | |||
912 | _hg_cmd_qdelete() { |
|
922 | _hg_cmd_qdelete() { | |
913 | _arguments -s -w : $_hg_global_opts \ |
|
923 | _arguments -s -w : $_hg_global_opts \ | |
914 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ |
|
924 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ | |
915 | '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \ |
|
925 | '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \ | |
916 | '*:unapplied patch:_hg_qdeletable' |
|
926 | '*:unapplied patch:_hg_qdeletable' | |
917 | } |
|
927 | } | |
918 |
|
928 | |||
919 | _hg_cmd_qdiff() { |
|
929 | _hg_cmd_qdiff() { | |
920 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
930 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
921 | '*:pattern:_hg_files' |
|
931 | '*:pattern:_hg_files' | |
922 | } |
|
932 | } | |
923 |
|
933 | |||
924 | _hg_cmd_qfinish() { |
|
934 | _hg_cmd_qfinish() { | |
925 | _arguments -s -w : $_hg_global_opts \ |
|
935 | _arguments -s -w : $_hg_global_opts \ | |
926 | '(--applied -a)'{-a,--applied}'[finish all applied patches]' \ |
|
936 | '(--applied -a)'{-a,--applied}'[finish all applied patches]' \ | |
927 | '*:patch:_hg_qapplied' |
|
937 | '*:patch:_hg_qapplied' | |
928 | } |
|
938 | } | |
929 |
|
939 | |||
930 | _hg_cmd_qfold() { |
|
940 | _hg_cmd_qfold() { | |
931 | _arguments -s -w : $_hg_global_opts $_h_commit_opts \ |
|
941 | _arguments -s -w : $_hg_global_opts $_h_commit_opts \ | |
932 | '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ |
|
942 | '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ | |
933 | '*:unapplied patch:_hg_qunapplied' |
|
943 | '*:unapplied patch:_hg_qunapplied' | |
934 | } |
|
944 | } | |
935 |
|
945 | |||
936 | _hg_cmd_qgoto() { |
|
946 | _hg_cmd_qgoto() { | |
937 | _arguments -s -w : $_hg_global_opts \ |
|
947 | _arguments -s -w : $_hg_global_opts \ | |
938 | '(--force -f)'{-f,--force}'[overwrite any local changes]' \ |
|
948 | '(--force -f)'{-f,--force}'[overwrite any local changes]' \ | |
939 | ':patch:_hg_qseries' |
|
949 | ':patch:_hg_qseries' | |
940 | } |
|
950 | } | |
941 |
|
951 | |||
942 | _hg_cmd_qguard() { |
|
952 | _hg_cmd_qguard() { | |
943 | _arguments -s -w : $_hg_global_opts \ |
|
953 | _arguments -s -w : $_hg_global_opts \ | |
944 | '(--list -l)'{-l,--list}'[list all patches and guards]' \ |
|
954 | '(--list -l)'{-l,--list}'[list all patches and guards]' \ | |
945 | '(--none -n)'{-n,--none}'[drop all guards]' \ |
|
955 | '(--none -n)'{-n,--none}'[drop all guards]' \ | |
946 | ':patch:_hg_qseries' \ |
|
956 | ':patch:_hg_qseries' \ | |
947 | '*:guards:_hg_qguards' |
|
957 | '*:guards:_hg_qguards' | |
948 | } |
|
958 | } | |
949 |
|
959 | |||
950 | _hg_cmd_qheader() { |
|
960 | _hg_cmd_qheader() { | |
951 | _arguments -s -w : $_hg_global_opts \ |
|
961 | _arguments -s -w : $_hg_global_opts \ | |
952 | ':patch:_hg_qseries' |
|
962 | ':patch:_hg_qseries' | |
953 | } |
|
963 | } | |
954 |
|
964 | |||
955 | _hg_cmd_qimport() { |
|
965 | _hg_cmd_qimport() { | |
956 | _arguments -s -w : $_hg_global_opts \ |
|
966 | _arguments -s -w : $_hg_global_opts \ | |
957 | '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ |
|
967 | '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ | |
958 | '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ |
|
968 | '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ | |
959 | '(--force -f)'{-f,--force}'[overwrite existing files]' \ |
|
969 | '(--force -f)'{-f,--force}'[overwrite existing files]' \ | |
960 | '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \ |
|
970 | '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \ | |
961 | '*:patch:_files' |
|
971 | '*:patch:_files' | |
962 | } |
|
972 | } | |
963 |
|
973 | |||
964 | _hg_cmd_qnew() { |
|
974 | _hg_cmd_qnew() { | |
965 | _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ |
|
975 | _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ | |
966 | '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ |
|
976 | '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ | |
967 | ':patch:' |
|
977 | ':patch:' | |
968 | } |
|
978 | } | |
969 |
|
979 | |||
970 | _hg_cmd_qnext() { |
|
980 | _hg_cmd_qnext() { | |
971 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
981 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
972 | } |
|
982 | } | |
973 |
|
983 | |||
974 | _hg_cmd_qpop() { |
|
984 | _hg_cmd_qpop() { | |
975 | _arguments -s -w : $_hg_global_opts \ |
|
985 | _arguments -s -w : $_hg_global_opts \ | |
976 | '(--all -a :)'{-a,--all}'[pop all patches]' \ |
|
986 | '(--all -a :)'{-a,--all}'[pop all patches]' \ | |
977 | '(--name -n)'{-n+,--name}'[queue name to pop]:' \ |
|
987 | '(--name -n)'{-n+,--name}'[queue name to pop]:' \ | |
978 | '(--force -f)'{-f,--force}'[forget any local changes]' \ |
|
988 | '(--force -f)'{-f,--force}'[forget any local changes]' \ | |
979 | ':patch:_hg_qapplied' |
|
989 | ':patch:_hg_qapplied' | |
980 | } |
|
990 | } | |
981 |
|
991 | |||
982 | _hg_cmd_qprev() { |
|
992 | _hg_cmd_qprev() { | |
983 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
993 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
984 | } |
|
994 | } | |
985 |
|
995 | |||
986 | _hg_cmd_qpush() { |
|
996 | _hg_cmd_qpush() { | |
987 | _arguments -s -w : $_hg_global_opts \ |
|
997 | _arguments -s -w : $_hg_global_opts \ | |
988 | '(--all -a :)'{-a,--all}'[apply all patches]' \ |
|
998 | '(--all -a :)'{-a,--all}'[apply all patches]' \ | |
989 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ |
|
999 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ | |
990 | '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ |
|
1000 | '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ | |
991 | '(--name -n)'{-n+,--name}'[merge queue name]:' \ |
|
1001 | '(--name -n)'{-n+,--name}'[merge queue name]:' \ | |
992 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ |
|
1002 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ | |
993 | '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \ |
|
1003 | '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \ | |
994 | '--move[reorder patch series and apply only the patch]' \ |
|
1004 | '--move[reorder patch series and apply only the patch]' \ | |
995 | ':patch:_hg_qunapplied' |
|
1005 | ':patch:_hg_qunapplied' | |
996 | } |
|
1006 | } | |
997 |
|
1007 | |||
998 | _hg_cmd_qrefresh() { |
|
1008 | _hg_cmd_qrefresh() { | |
999 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ |
|
1009 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ | |
1000 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ |
|
1010 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ | |
1001 | '(--short -s)'{-s,--short}'[short refresh]' \ |
|
1011 | '(--short -s)'{-s,--short}'[short refresh]' \ | |
1002 | '*:files:_hg_files' |
|
1012 | '*:files:_hg_files' | |
1003 | } |
|
1013 | } | |
1004 |
|
1014 | |||
1005 | _hg_cmd_qrename() { |
|
1015 | _hg_cmd_qrename() { | |
1006 | _arguments -s -w : $_hg_global_opts \ |
|
1016 | _arguments -s -w : $_hg_global_opts \ | |
1007 | ':patch:_hg_qseries' \ |
|
1017 | ':patch:_hg_qseries' \ | |
1008 | ':destination:' |
|
1018 | ':destination:' | |
1009 | } |
|
1019 | } | |
1010 |
|
1020 | |||
1011 | _hg_cmd_qselect() { |
|
1021 | _hg_cmd_qselect() { | |
1012 | _arguments -s -w : $_hg_global_opts \ |
|
1022 | _arguments -s -w : $_hg_global_opts \ | |
1013 | '(--none -n :)'{-n,--none}'[disable all guards]' \ |
|
1023 | '(--none -n :)'{-n,--none}'[disable all guards]' \ | |
1014 | '(--series -s :)'{-s,--series}'[list all guards in series file]' \ |
|
1024 | '(--series -s :)'{-s,--series}'[list all guards in series file]' \ | |
1015 | '--pop[pop to before first guarded applied patch]' \ |
|
1025 | '--pop[pop to before first guarded applied patch]' \ | |
1016 | '--reapply[pop and reapply patches]' \ |
|
1026 | '--reapply[pop and reapply patches]' \ | |
1017 | '*:guards:_hg_qguards' |
|
1027 | '*:guards:_hg_qguards' | |
1018 | } |
|
1028 | } | |
1019 |
|
1029 | |||
1020 | _hg_cmd_qseries() { |
|
1030 | _hg_cmd_qseries() { | |
1021 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \ |
|
1031 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \ | |
1022 | '(--missing -m)'{-m,--missing}'[print patches not in series]' |
|
1032 | '(--missing -m)'{-m,--missing}'[print patches not in series]' | |
1023 | } |
|
1033 | } | |
1024 |
|
1034 | |||
1025 | _hg_cmd_qunapplied() { |
|
1035 | _hg_cmd_qunapplied() { | |
1026 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
1036 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
1027 | } |
|
1037 | } | |
1028 |
|
1038 | |||
1029 | _hg_cmd_qtop() { |
|
1039 | _hg_cmd_qtop() { | |
1030 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
1040 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
1031 | } |
|
1041 | } | |
1032 |
|
1042 | |||
1033 | _hg_cmd_strip() { |
|
1043 | _hg_cmd_strip() { | |
1034 | _arguments -s -w : $_hg_global_opts \ |
|
1044 | _arguments -s -w : $_hg_global_opts \ | |
1035 | '(--force -f)'{-f,--force}'[force multi-head removal]' \ |
|
1045 | '(--force -f)'{-f,--force}'[force multi-head removal]' \ | |
1036 | '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ |
|
1046 | '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ | |
1037 | '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ |
|
1047 | '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ | |
1038 | ':revision:_hg_labels' |
|
1048 | ':revision:_hg_labels' | |
1039 | } |
|
1049 | } | |
1040 |
|
1050 | |||
1041 | # Patchbomb |
|
1051 | # Patchbomb | |
1042 | _hg_cmd_email() { |
|
1052 | _hg_cmd_email() { | |
1043 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
1053 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
1044 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ |
|
1054 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ | |
1045 | '--plain[omit hg patch header]' \ |
|
1055 | '--plain[omit hg patch header]' \ | |
1046 | '--body[send patches as inline message text (default)]' \ |
|
1056 | '--body[send patches as inline message text (default)]' \ | |
1047 | '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \ |
|
1057 | '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \ | |
1048 | '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \ |
|
1058 | '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \ | |
1049 | '--bundlename[name of the bundle attachment file (default: bundle)]:' \ |
|
1059 | '--bundlename[name of the bundle attachment file (default: bundle)]:' \ | |
1050 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ |
|
1060 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ | |
1051 | '--force[run even when remote repository is unrelated (with -b/--bundle)]' \ |
|
1061 | '--force[run even when remote repository is unrelated (with -b/--bundle)]' \ | |
1052 | '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \ |
|
1062 | '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \ | |
1053 | '--intro[send an introduction email for a single patch]' \ |
|
1063 | '--intro[send an introduction email for a single patch]' \ | |
1054 | '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \ |
|
1064 | '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \ | |
1055 | '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \ |
|
1065 | '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \ | |
1056 | '*--bcc[email addresses of blind carbon copy recipients]:email:' \ |
|
1066 | '*--bcc[email addresses of blind carbon copy recipients]:email:' \ | |
1057 | '*'{-c+,--cc}'[email addresses of copy recipients]:email:' \ |
|
1067 | '*'{-c+,--cc}'[email addresses of copy recipients]:email:' \ | |
1058 | '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \ |
|
1068 | '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \ | |
1059 | '--date[use the given date as the sending date]:date:' \ |
|
1069 | '--date[use the given date as the sending date]:date:' \ | |
1060 | '--desc[use the given file as the series description]:files:_files' \ |
|
1070 | '--desc[use the given file as the series description]:files:_files' \ | |
1061 | '(--from -f)'{-f,--from}'[email address of sender]:email:' \ |
|
1071 | '(--from -f)'{-f,--from}'[email address of sender]:email:' \ | |
1062 | '(--test -n)'{-n,--test}'[print messages that would be sent]' \ |
|
1072 | '(--test -n)'{-n,--test}'[print messages that would be sent]' \ | |
1063 | '(--mbox -m)'{-m,--mbox}'[write messages to mbox file instead of sending them]:file:' \ |
|
1073 | '(--mbox -m)'{-m,--mbox}'[write messages to mbox file instead of sending them]:file:' \ | |
1064 | '*--reply-to[email addresses replies should be sent to]:email:' \ |
|
1074 | '*--reply-to[email addresses replies should be sent to]:email:' \ | |
1065 | '(--subject -s)'{-s,--subject}'[subject of first message (intro or single patch)]:subject:' \ |
|
1075 | '(--subject -s)'{-s,--subject}'[subject of first message (intro or single patch)]:subject:' \ | |
1066 | '--in-reply-to[message identifier to reply to]:msgid:' \ |
|
1076 | '--in-reply-to[message identifier to reply to]:msgid:' \ | |
1067 | '*--flag[flags to add in subject prefixes]:flag:' \ |
|
1077 | '*--flag[flags to add in subject prefixes]:flag:' \ | |
1068 | '*'{-t,--to}'[email addresses of recipients]:email:' \ |
|
1078 | '*'{-t,--to}'[email addresses of recipients]:email:' \ | |
1069 | ':revision:_hg_revrange' |
|
1079 | ':revision:_hg_revrange' | |
1070 | } |
|
1080 | } | |
1071 |
|
1081 | |||
1072 | # Rebase |
|
1082 | # Rebase | |
1073 | _hg_cmd_rebase() { |
|
1083 | _hg_cmd_rebase() { | |
1074 | _arguments -s -w : $_hg_global_opts \ |
|
1084 | _arguments -s -w : $_hg_global_opts \ | |
1075 | '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \ |
|
1085 | '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \ | |
1076 | '(--source -s)'{-s,--source}'[rebase from the specified changeset]:revision:_hg_labels' \ |
|
1086 | '(--source -s)'{-s,--source}'[rebase from the specified changeset]:revision:_hg_labels' \ | |
1077 | '(--base -b)'{-b,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \ |
|
1087 | '(--base -b)'{-b,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \ | |
1078 | '(--dest -d)'{-d,--dest}'[rebase onto the specified changeset]' \ |
|
1088 | '(--dest -d)'{-d,--dest}'[rebase onto the specified changeset]' \ | |
1079 | '--collapse[collapse the rebased changeset]' \ |
|
1089 | '--collapse[collapse the rebased changeset]' \ | |
1080 | '(--message -m)'{-m+,--message}'[use <text> as collapse commit message]:text:' \ |
|
1090 | '(--message -m)'{-m+,--message}'[use <text> as collapse commit message]:text:' \ | |
1081 | '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ |
|
1091 | '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ | |
1082 | '(--logfile -l)'{-l+,--logfile}'[read collapse commit message from <file>]:log file:_files -g \*.txt' \ |
|
1092 | '(--logfile -l)'{-l+,--logfile}'[read collapse commit message from <file>]:log file:_files -g \*.txt' \ | |
1083 | '--keep[keep original changeset]' \ |
|
1093 | '--keep[keep original changeset]' \ | |
1084 | '--keepbranches[keep original branch name]' \ |
|
1094 | '--keepbranches[keep original branch name]' \ | |
1085 | '(--tool -t)'{-t,--tool}'[specify merge tool]' \ |
|
1095 | '(--tool -t)'{-t,--tool}'[specify merge tool]' \ | |
1086 | '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \ |
|
1096 | '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \ | |
1087 | '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \ |
|
1097 | '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \ | |
1088 | } |
|
1098 | } | |
1089 |
|
1099 | |||
1090 | _hg "$@" |
|
1100 | _hg "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now