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