Show More
@@ -1,570 +1,651 b'' | |||||
1 | #compdef hg |
|
1 | #compdef hg | |
2 |
|
2 | |||
3 | # Zsh completion script for mercurial. Rename this file to _hg and copy |
|
3 | # Zsh completion script for mercurial. Rename this file to _hg and copy | |
4 | # it into your zsh function path (/usr/share/zsh/site-functions for |
|
4 | # it into your zsh function path (/usr/share/zsh/site-functions for | |
5 | # instance) |
|
5 | # instance) | |
6 | # |
|
6 | # | |
7 | # Copyright (C) 2005 Steve Borho |
|
7 | # Copyright (C) 2005 Steve Borho | |
8 | # Copyright (C) 2006 Brendan Cully |
|
8 | # Copyright (C) 2006 Brendan Cully | |
9 | # |
|
9 | # | |
10 | # This is free software; you can redistribute it and/or modify it under |
|
10 | # This is free software; you can redistribute it and/or modify it under | |
11 | # the terms of the GNU General Public License as published by the Free |
|
11 | # the terms of the GNU General Public License as published by the Free | |
12 | # Software Foundation; either version 2 of the License, or (at your |
|
12 | # Software Foundation; either version 2 of the License, or (at your | |
13 | # option) any later version. |
|
13 | # option) any later version. | |
14 | # |
|
14 | # | |
15 |
|
15 | |||
16 | local curcontext="$curcontext" state line |
|
16 | local curcontext="$curcontext" state line | |
17 | local repos newFiles addedFiles commitMessage |
|
17 | local repos newFiles addedFiles commitMessage | |
18 | typeset -A _hg_cmd_globals |
|
18 | typeset -A _hg_cmd_globals | |
19 |
|
19 | |||
20 | _hg() { |
|
20 | _hg() { | |
21 | local cmd |
|
21 | local cmd | |
22 | integer i=2 |
|
22 | integer i=2 | |
23 | _hg_cmd_globals=() |
|
23 | _hg_cmd_globals=() | |
24 |
|
24 | |||
25 | while (( i < $#words )) |
|
25 | while (( i < $#words )) | |
26 | do |
|
26 | do | |
27 | case "$words[$i]" in |
|
27 | case "$words[$i]" in | |
28 | -R|--repository|--cwd|--config) |
|
28 | -R|--repository|--cwd|--config) | |
29 | # pass along arguments to hg completer |
|
29 | # pass along arguments to hg completer | |
30 | _hg_cmd_globals+="$words[$i]" |
|
30 | _hg_cmd_globals+="$words[$i]" | |
31 | _hg_cmd_globals+="$words[$i+1]" |
|
31 | _hg_cmd_globals+="$words[$i+1]" | |
32 | (( i += 2 )) |
|
32 | (( i += 2 )) | |
33 | continue |
|
33 | continue | |
34 | ;; |
|
34 | ;; | |
35 | -R*) |
|
35 | -R*) | |
36 | _hg_cmd_globals+="$words[$i]" |
|
36 | _hg_cmd_globals+="$words[$i]" | |
37 | (( i++ )) |
|
37 | (( i++ )) | |
38 | continue |
|
38 | continue | |
39 | ;; |
|
39 | ;; | |
40 | -*) |
|
40 | -*) | |
41 | # skip option |
|
41 | # skip option | |
42 | (( i++ )) |
|
42 | (( i++ )) | |
43 | continue |
|
43 | continue | |
44 | ;; |
|
44 | ;; | |
45 | esac |
|
45 | esac | |
46 | if [[ -z "$cmd" ]] |
|
46 | if [[ -z "$cmd" ]] | |
47 | then |
|
47 | then | |
48 | cmd="$words[$i]" |
|
48 | cmd="$words[$i]" | |
49 | words[$i]=() |
|
49 | words[$i]=() | |
50 | (( CURRENT-- )) |
|
50 | (( CURRENT-- )) | |
51 | fi |
|
51 | fi | |
52 | (( i++ )) |
|
52 | (( i++ )) | |
53 | done |
|
53 | done | |
54 |
|
54 | |||
55 | if [[ -z "$cmd" ]] |
|
55 | if [[ -z "$cmd" ]] | |
56 | then |
|
56 | then | |
57 | _arguments -s -w : $_hg_global_opts \ |
|
57 | _arguments -s -w : $_hg_global_opts \ | |
58 | ':mercurial command:_hg_commands' |
|
58 | ':mercurial command:_hg_commands' | |
59 | return |
|
59 | return | |
60 | fi |
|
60 | fi | |
61 |
|
61 | |||
62 | # resolve abbreviations and aliases |
|
62 | # resolve abbreviations and aliases | |
63 | if ! (( $+functions[_hg_cmd_${cmd}] )) |
|
63 | if ! (( $+functions[_hg_cmd_${cmd}] )) | |
64 | then |
|
64 | then | |
65 | local cmdexp |
|
65 | local cmdexp | |
66 | (( $#_hg_cmd_list )) || _hg_get_commands |
|
66 | (( $#_hg_cmd_list )) || _hg_get_commands | |
67 |
|
67 | |||
68 | cmdexp=$_hg_cmd_list[(r)${cmd}*] |
|
68 | cmdexp=$_hg_cmd_list[(r)${cmd}*] | |
69 | if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]] |
|
69 | if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]] | |
70 | then |
|
70 | then | |
71 | # might be nice to rewrite the command line with the expansion |
|
71 | # might be nice to rewrite the command line with the expansion | |
72 | cmd="$cmdexp" |
|
72 | cmd="$cmdexp" | |
73 | fi |
|
73 | fi | |
74 | if [[ -n $_hg_alias_list[$cmd] ]] |
|
74 | if [[ -n $_hg_alias_list[$cmd] ]] | |
75 | then |
|
75 | then | |
76 | cmd=$_hg_alias_list[$cmd] |
|
76 | cmd=$_hg_alias_list[$cmd] | |
77 | fi |
|
77 | fi | |
78 | fi |
|
78 | fi | |
79 |
|
79 | |||
80 | if (( $+functions[_hg_cmd_${cmd}] )) |
|
80 | if (( $+functions[_hg_cmd_${cmd}] )) | |
81 | then |
|
81 | then | |
82 | curcontext="${curcontext%:*:*}:hg-${cmd}:" |
|
82 | curcontext="${curcontext%:*:*}:hg-${cmd}:" | |
83 | _hg_cmd_${cmd} |
|
83 | _hg_cmd_${cmd} | |
84 | return |
|
84 | return | |
85 | fi |
|
85 | fi | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | _hg_get_commands() { |
|
88 | _hg_get_commands() { | |
89 | typeset -ga _hg_cmd_list |
|
89 | typeset -ga _hg_cmd_list | |
90 | typeset -gA _hg_alias_list |
|
90 | typeset -gA _hg_alias_list | |
91 | local hline cmd cmdalias |
|
91 | local hline cmd cmdalias | |
92 | _call_program help hg --verbose help | while read -A hline |
|
92 | _call_program help hg --verbose help | while read -A hline | |
93 | do |
|
93 | do | |
94 | cmd="$hline[1]" |
|
94 | cmd="$hline[1]" | |
95 | case $cmd in |
|
95 | case $cmd in | |
96 | *:) |
|
96 | *:) | |
97 | cmd=${cmd%:} |
|
97 | cmd=${cmd%:} | |
98 | _hg_cmd_list+=($cmd) |
|
98 | _hg_cmd_list+=($cmd) | |
99 | ;; |
|
99 | ;; | |
100 | *,) |
|
100 | *,) | |
101 | cmd=${cmd%,} |
|
101 | cmd=${cmd%,} | |
102 | _hg_cmd_list+=($cmd) |
|
102 | _hg_cmd_list+=($cmd) | |
103 | integer i=2 |
|
103 | integer i=2 | |
104 | while (( i <= $#hline )) |
|
104 | while (( i <= $#hline )) | |
105 | do |
|
105 | do | |
106 | cmdalias=${hline[$i]%(:|,)} |
|
106 | cmdalias=${hline[$i]%(:|,)} | |
107 | _hg_cmd_list+=($cmdalias) |
|
107 | _hg_cmd_list+=($cmdalias) | |
108 | _hg_alias_list+=($cmdalias $cmd) |
|
108 | _hg_alias_list+=($cmdalias $cmd) | |
109 | (( i++ )) |
|
109 | (( i++ )) | |
110 | done |
|
110 | done | |
111 | ;; |
|
111 | ;; | |
112 | esac |
|
112 | esac | |
113 | done |
|
113 | done | |
114 | } |
|
114 | } | |
115 |
|
115 | |||
116 | _hg_commands() { |
|
116 | _hg_commands() { | |
117 | (( $#_hg_cmd_list )) || _hg_get_commands |
|
117 | (( $#_hg_cmd_list )) || _hg_get_commands | |
118 | _describe -t hg-commands 'mercurial command' _hg_cmd_list |
|
118 | _describe -t hg-commands 'mercurial command' _hg_cmd_list | |
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | _hg_tags() { |
|
121 | _hg_tags() { | |
122 | typeset -a tags |
|
122 | typeset -a tags | |
123 | local tag rev |
|
123 | local tag rev | |
124 |
|
124 | |||
125 | _hg_cmd tags 2> /dev/null | while read tag rev |
|
125 | _hg_cmd tags 2> /dev/null | while read tag rev | |
126 | do |
|
126 | do | |
127 | tags+=($tag) |
|
127 | tags+=($tag) | |
128 | done |
|
128 | done | |
129 | (( $#tags )) && _describe -t hg-tags 'tags' tags |
|
129 | (( $#tags )) && _describe -t hg-tags 'tags' tags | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | _hg_status() { |
|
132 | _hg_status() { | |
133 | status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"}) |
|
133 | status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"}) | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | _hg_unknown() { |
|
136 | _hg_unknown() { | |
137 | typeset -a status_files |
|
137 | typeset -a status_files | |
138 | _hg_status u |
|
138 | _hg_status u | |
139 | (( $#status_files )) && _describe -t hg-unknown-files 'unknown files' status_files |
|
139 | (( $#status_files )) && _describe -t hg-unknown-files 'unknown files' status_files | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | _hg_missing() { |
|
142 | _hg_missing() { | |
143 | typeset -a status_files |
|
143 | typeset -a status_files | |
144 | _hg_status d |
|
144 | _hg_status d | |
145 | (( $#status_files )) && _describe -t hg-missing-files 'missing files' status_files |
|
145 | (( $#status_files )) && _describe -t hg-missing-files 'missing files' status_files | |
146 | } |
|
146 | } | |
147 |
|
147 | |||
148 | _hg_addremove() { |
|
148 | _hg_addremove() { | |
149 | _alternative "unknown files:unknown files:_hg_unknown" \ |
|
149 | _alternative "unknown files:unknown files:_hg_unknown" \ | |
150 | "missing files:missing files:_hg_missing" |
|
150 | "missing files:missing files:_hg_missing" | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 | _hg_paths() { |
|
153 | _hg_paths() { | |
154 | typeset -a paths pnames |
|
154 | typeset -a paths pnames | |
155 | _hg_cmd paths 2> /dev/null | while read -A pnames |
|
155 | _hg_cmd paths 2> /dev/null | while read -A pnames | |
156 | do |
|
156 | do | |
157 | paths+=($pnames[1]) |
|
157 | paths+=($pnames[1]) | |
158 | done |
|
158 | done | |
159 | (( $#paths )) && _describe -t hg-paths 'repository aliases' paths |
|
159 | (( $#paths )) && _describe -t hg-paths 'repository aliases' paths | |
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | _hg_remote() { |
|
162 | _hg_remote() { | |
163 | _alternative 'repository aliases:repository aliases:_hg_paths' \ |
|
163 | _alternative 'repository aliases:repository aliases:_hg_paths' \ | |
164 | 'directory:directory:_files -/' |
|
164 | 'directory:directory:_files -/' | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | _hg_qseries() { |
|
|||
168 | typeset -a patches |
|
|||
169 | patches=($(_hg_cmd qseries)) |
|
|||
170 | (( $#patches )) && _describe -t hg-patches 'patches' patches |
|
|||
171 | } |
|
|||
172 |
|
||||
173 | _hg_qapplied() { |
|
|||
174 | typeset -a patches |
|
|||
175 | patches=($(_hg_cmd qapplied)) |
|
|||
176 | (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches |
|
|||
177 | } |
|
|||
178 |
|
||||
179 | _hg_qunapplied() { |
|
|||
180 | typeset -a patches |
|
|||
181 | patches=($(_hg_cmd qunapplied)) |
|
|||
182 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches |
|
|||
183 | } |
|
|||
184 |
|
||||
185 | # Common options |
|
167 | # Common options | |
186 | _hg_global_opts=( |
|
168 | _hg_global_opts=( | |
187 | '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' |
|
169 | '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' | |
188 | '--cwd[change working directory]:new working directory:_files -/' |
|
170 | '--cwd[change working directory]:new working directory:_files -/' | |
189 | '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]' |
|
171 | '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]' | |
190 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' |
|
172 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' | |
191 | '(--quiet -q)'{-q,--quiet}'[suppress output]' |
|
173 | '(--quiet -q)'{-q,--quiet}'[suppress output]' | |
192 | '(--help -h)'{-h,--help}'[display help and exit]' |
|
174 | '(--help -h)'{-h,--help}'[display help and exit]' | |
193 | '--debug[debug mode]' |
|
175 | '--debug[debug mode]' | |
194 | '--debugger[start debugger]' |
|
176 | '--debugger[start debugger]' | |
195 | '--traceback[print traceback on exception]' |
|
177 | '--traceback[print traceback on exception]' | |
196 | '--time[time how long the command takes]' |
|
178 | '--time[time how long the command takes]' | |
197 | '--profile[profile]' |
|
179 | '--profile[profile]' | |
198 | '--version[output version information and exit]' |
|
180 | '--version[output version information and exit]' | |
199 | ) |
|
181 | ) | |
200 |
|
182 | |||
201 | _hg_pat_opts=( |
|
183 | _hg_pat_opts=( | |
202 | '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' |
|
184 | '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' | |
203 | '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') |
|
185 | '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') | |
204 |
|
186 | |||
205 | _hg_diff_opts=( |
|
187 | _hg_diff_opts=( | |
206 | '(--text -a)'{-a,--text}'[treat all files as text]' |
|
188 | '(--text -a)'{-a,--text}'[treat all files as text]' | |
207 | '(--git -g)'{-g,--git}'[use git extended diff format]' |
|
189 | '(--git -g)'{-g,--git}'[use git extended diff format]' | |
208 | "--nodates[don't include dates in diff headers]") |
|
190 | "--nodates[don't include dates in diff headers]") | |
209 |
|
191 | |||
210 | _hg_dryrun_opts=( |
|
192 | _hg_dryrun_opts=( | |
211 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]') |
|
193 | '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]') | |
212 |
|
194 | |||
213 | _hg_style_opts=( |
|
195 | _hg_style_opts=( | |
214 | '--style[display using template map file]:' |
|
196 | '--style[display using template map file]:' | |
215 | '--template[display with template]:') |
|
197 | '--template[display with template]:') | |
216 |
|
198 | |||
217 | _hg_commit_opts=( |
|
199 | _hg_commit_opts=( | |
218 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' |
|
200 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' | |
219 | '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:' |
|
201 | '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:' | |
220 | '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files') |
|
202 | '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files') | |
221 |
|
203 | |||
222 | _hg_remote_opts=( |
|
204 | _hg_remote_opts=( | |
223 | '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' |
|
205 | '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' | |
224 | '--remotecmd[specify hg command to run on the remote side]:') |
|
206 | '--remotecmd[specify hg command to run on the remote side]:') | |
225 |
|
207 | |||
226 | _hg_cmd() { |
|
208 | _hg_cmd() { | |
227 | _call_program hg hg "$_hg_cmd_globals[@]" "$@" |
|
209 | _call_program hg hg "$_hg_cmd_globals[@]" "$@" | |
228 | } |
|
210 | } | |
229 |
|
211 | |||
230 | _hg_cmd_add() { |
|
212 | _hg_cmd_add() { | |
231 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
213 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
232 | '*:unknown files:_hg_unknown' |
|
214 | '*:unknown files:_hg_unknown' | |
233 | } |
|
215 | } | |
234 |
|
216 | |||
235 | _hg_cmd_addremove() { |
|
217 | _hg_cmd_addremove() { | |
236 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
218 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
237 | '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \ |
|
219 | '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \ | |
238 | '*:unknown or missing files:_hg_addremove' |
|
220 | '*:unknown or missing files:_hg_addremove' | |
239 | } |
|
221 | } | |
240 |
|
222 | |||
241 | _hg_cmd_annotate() { |
|
223 | _hg_cmd_annotate() { | |
242 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
224 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
243 | '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \ |
|
225 | '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \ | |
244 | '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ |
|
226 | '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ | |
245 | '(--text -a)'{-a,--text}'[treat all files as text]' \ |
|
227 | '(--text -a)'{-a,--text}'[treat all files as text]' \ | |
246 | '(--user -u)'{-u,--user}'[list the author]' \ |
|
228 | '(--user -u)'{-u,--user}'[list the author]' \ | |
247 | '(--date -d)'{-d,--date}'[list the date]' \ |
|
229 | '(--date -d)'{-d,--date}'[list the date]' \ | |
248 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ |
|
230 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ | |
249 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ |
|
231 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ | |
250 | '*:files:_files -W $(_hg_cmd root)' |
|
232 | '*:files:_files -W $(_hg_cmd root)' | |
251 | } |
|
233 | } | |
252 |
|
234 | |||
253 | _hg_cmd_archive() { |
|
235 | _hg_cmd_archive() { | |
254 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
236 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
255 | '--no-decode[do not pass files through decoders]' \ |
|
237 | '--no-decode[do not pass files through decoders]' \ | |
256 | '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ |
|
238 | '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ | |
257 | '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \ |
|
239 | '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \ | |
258 | '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ |
|
240 | '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ | |
259 | '*:destination:_files' |
|
241 | '*:destination:_files' | |
260 | } |
|
242 | } | |
261 |
|
243 | |||
262 | _hg_cmd_bundle() { |
|
244 | _hg_cmd_bundle() { | |
263 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
245 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
264 | '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ |
|
246 | '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ | |
265 | '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \ |
|
247 | '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \ | |
266 | ':output file:_files' \ |
|
248 | ':output file:_files' \ | |
267 | ':destination repository:_files -/' |
|
249 | ':destination repository:_files -/' | |
268 | } |
|
250 | } | |
269 |
|
251 | |||
270 | _hg_cmd_cat() { |
|
252 | _hg_cmd_cat() { | |
271 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
253 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
272 | '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ |
|
254 | '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ | |
273 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ |
|
255 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ | |
274 | '*:file:_files -W $(_hg_cmd root)' |
|
256 | '*:file:_files -W $(_hg_cmd root)' | |
275 | } |
|
257 | } | |
276 |
|
258 | |||
277 | _hg_cmd_clone() { |
|
259 | _hg_cmd_clone() { | |
278 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
260 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
279 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ |
|
261 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ | |
280 | '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \ |
|
262 | '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \ | |
281 | '--uncompressed[use uncompressed transfer (fast over LAN)]' \ |
|
263 | '--uncompressed[use uncompressed transfer (fast over LAN)]' \ | |
282 | ':source repository:_hg_remote' \ |
|
264 | ':source repository:_hg_remote' \ | |
283 | ':destination:_files -/' |
|
265 | ':destination:_files -/' | |
284 | } |
|
266 | } | |
285 |
|
267 | |||
286 | _hg_cmd_commit() { |
|
268 | _hg_cmd_commit() { | |
287 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
269 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
288 | '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' |
|
270 | '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' | |
289 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
271 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
290 | '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \ |
|
272 | '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \ | |
291 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
273 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
292 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
274 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
293 | '*:file:_files -W $(_hg_cmd root)' |
|
275 | '*:file:_files -W $(_hg_cmd root)' | |
294 | } |
|
276 | } | |
295 |
|
277 | |||
296 | _hg_cmd_copy() { |
|
278 | _hg_cmd_copy() { | |
297 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
279 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
298 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ |
|
280 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ | |
299 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
281 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ | |
300 | '*:file:_files -W $(_hg_cmd root)' |
|
282 | '*:file:_files -W $(_hg_cmd root)' | |
301 | } |
|
283 | } | |
302 |
|
284 | |||
303 | _hg_cmd_diff() { |
|
285 | _hg_cmd_diff() { | |
304 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ |
|
286 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ | |
305 | '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \ |
|
287 | '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \ | |
306 | '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ |
|
288 | '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ | |
307 | '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ |
|
289 | '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ | |
308 | '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ |
|
290 | '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ | |
309 | '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ |
|
291 | '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ | |
310 | '*:file:_files -W $(_hg_cmd root)' |
|
292 | '*:file:_files -W $(_hg_cmd root)' | |
311 | } |
|
293 | } | |
312 |
|
294 | |||
313 | _hg_cmd_export() { |
|
295 | _hg_cmd_export() { | |
314 | _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ |
|
296 | _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ | |
315 | '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ |
|
297 | '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ | |
316 | '--switch-parent[diff against the second parent]' \ |
|
298 | '--switch-parent[diff against the second parent]' \ | |
317 | '*:revision:_hg_tags' |
|
299 | '*:revision:_hg_tags' | |
318 | } |
|
300 | } | |
319 |
|
301 | |||
320 | _hg_cmd_grep() { |
|
302 | _hg_cmd_grep() { | |
321 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
303 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
322 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ |
|
304 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ | |
323 | '--all[print all revisions with matches]' \ |
|
305 | '--all[print all revisions with matches]' \ | |
324 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ |
|
306 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ | |
325 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ |
|
307 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ | |
326 | '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ |
|
308 | '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ | |
327 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ |
|
309 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ | |
328 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \ |
|
310 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \ | |
329 | '(--user -u)'{-u,--user}'[print user who committed change]' \ |
|
311 | '(--user -u)'{-u,--user}'[print user who committed change]' \ | |
330 | '*:search pattern:_files -W $(_hg_cmd root)' |
|
312 | '*:search pattern:_files -W $(_hg_cmd root)' | |
331 | } |
|
313 | } | |
332 |
|
314 | |||
333 | _hg_cmd_heads() { |
|
315 | _hg_cmd_heads() { | |
334 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
316 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
335 | '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags' |
|
317 | '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags' | |
336 | } |
|
318 | } | |
337 |
|
319 | |||
338 | _hg_cmd_help() { |
|
320 | _hg_cmd_help() { | |
339 | _arguments -s -w : $_hg_global_opts \ |
|
321 | _arguments -s -w : $_hg_global_opts \ | |
340 | '*:mercurial command:_hg_commands' |
|
322 | '*:mercurial command:_hg_commands' | |
341 | } |
|
323 | } | |
342 |
|
324 | |||
343 | _hg_cmd_import() { |
|
325 | _hg_cmd_import() { | |
344 | _arguments -s -w : $_hg_global_opts \ |
|
326 | _arguments -s -w : $_hg_global_opts \ | |
345 | '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \ |
|
327 | '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \ | |
346 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
328 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
347 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ |
|
329 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ | |
348 | '*:patch:_files' |
|
330 | '*:patch:_files' | |
349 | } |
|
331 | } | |
350 |
|
332 | |||
351 | _hg_cmd_incoming() { |
|
333 | _hg_cmd_incoming() { | |
352 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ |
|
334 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ | |
353 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ |
|
335 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ | |
354 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
336 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ | |
355 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
337 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
356 | '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \ |
|
338 | '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \ | |
357 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
339 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ | |
358 | '--bundle[file to store the bundles into]:bundle file:_files' \ |
|
340 | '--bundle[file to store the bundles into]:bundle file:_files' \ | |
359 | ':source:_hg_remote' |
|
341 | ':source:_hg_remote' | |
360 | } |
|
342 | } | |
361 |
|
343 | |||
362 | _hg_cmd_init() { |
|
344 | _hg_cmd_init() { | |
363 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
345 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
364 | ':dir:_files -/' |
|
346 | ':dir:_files -/' | |
365 | } |
|
347 | } | |
366 |
|
348 | |||
367 | _hg_cmd_locate() { |
|
349 | _hg_cmd_locate() { | |
368 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
350 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
369 | '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \ |
|
351 | '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \ | |
370 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
352 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ | |
371 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ |
|
353 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ | |
372 | '*:search pattern:_files -W $(_hg_cmd root)' |
|
354 | '*:search pattern:_files -W $(_hg_cmd root)' | |
373 | } |
|
355 | } | |
374 |
|
356 | |||
375 | _hg_cmd_log() { |
|
357 | _hg_cmd_log() { | |
376 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ |
|
358 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ | |
377 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ |
|
359 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ | |
378 | '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ |
|
360 | '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ | |
379 | '(--copies -C)'{-C,--copies}'[show copied files]' \ |
|
361 | '(--copies -C)'{-C,--copies}'[show copied files]' \ | |
380 | '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ |
|
362 | '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ | |
381 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
|
363 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | |
382 | '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \ |
|
364 | '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \ | |
383 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ |
|
365 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ | |
384 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ |
|
366 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ | |
385 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
367 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
386 | '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ |
|
368 | '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ | |
387 | '*:files:_files -W $(_hg_cmd root)' |
|
369 | '*:files:_files -W $(_hg_cmd root)' | |
388 | } |
|
370 | } | |
389 |
|
371 | |||
390 | _hg_cmd_manifest() { |
|
372 | _hg_cmd_manifest() { | |
391 | _arguments -s -w : $_hg_global_opts \ |
|
373 | _arguments -s -w : $_hg_global_opts \ | |
392 | ':revision:_hg_tags' |
|
374 | ':revision:_hg_tags' | |
393 | } |
|
375 | } | |
394 |
|
376 | |||
395 | _hg_cmd_outgoing() { |
|
377 | _hg_cmd_outgoing() { | |
396 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ |
|
378 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ | |
397 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ |
|
379 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ | |
398 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
380 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ | |
399 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
381 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
400 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ |
|
382 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ | |
401 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
383 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ | |
402 | ':destination:_hg_remote' |
|
384 | ':destination:_hg_remote' | |
403 | } |
|
385 | } | |
404 |
|
386 | |||
405 | _hg_cmd_parents() { |
|
387 | _hg_cmd_parents() { | |
406 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
388 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
407 | '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \ |
|
389 | '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \ | |
408 | ':revision:_hg_tags' |
|
390 | ':revision:_hg_tags' | |
409 | } |
|
391 | } | |
410 |
|
392 | |||
411 | _hg_cmd_paths() { |
|
393 | _hg_cmd_paths() { | |
412 | _arguments -s -w : $_hg_global_opts \ |
|
394 | _arguments -s -w : $_hg_global_opts \ | |
413 | ':path:_hg_paths' |
|
395 | ':path:_hg_paths' | |
414 | } |
|
396 | } | |
415 |
|
397 | |||
416 | _hg_cmd_pull() { |
|
398 | _hg_cmd_pull() { | |
417 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
399 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
418 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ |
|
400 | '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ | |
419 | '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ |
|
401 | '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ | |
420 | ':source:_hg_remote' |
|
402 | ':source:_hg_remote' | |
421 | } |
|
403 | } | |
422 |
|
404 | |||
423 | _hg_cmd_push() { |
|
405 | _hg_cmd_push() { | |
424 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
406 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
425 | '(--force -f)'{-f,--force}'[force push]' \ |
|
407 | '(--force -f)'{-f,--force}'[force push]' \ | |
426 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ |
|
408 | '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ | |
427 | ':destination:_hg_remote' |
|
409 | ':destination:_hg_remote' | |
428 | } |
|
410 | } | |
429 |
|
411 | |||
430 | _hg_cmd_remove() { |
|
412 | _hg_cmd_remove() { | |
431 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
413 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
432 | '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ |
|
414 | '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ | |
433 | '(--force -f)'{-f,--force}'[remove file even if modified]' \ |
|
415 | '(--force -f)'{-f,--force}'[remove file even if modified]' \ | |
434 | '*:file:_files -W $(_hg_cmd root)' |
|
416 | '*:file:_files -W $(_hg_cmd root)' | |
435 | } |
|
417 | } | |
436 |
|
418 | |||
437 | _hg_cmd_rename() { |
|
419 | _hg_cmd_rename() { | |
438 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
420 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
439 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ |
|
421 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ | |
440 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
422 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ | |
441 | '*:file:_files -W $(_hg_cmd root)' |
|
423 | '*:file:_files -W $(_hg_cmd root)' | |
442 | } |
|
424 | } | |
443 |
|
425 | |||
444 | _hg_cmd_revert() { |
|
426 | _hg_cmd_revert() { | |
445 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
427 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
446 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ |
|
428 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ | |
447 | '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ |
|
429 | '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ | |
448 | '--no-backup[do not save backup copies of files]' \ |
|
430 | '--no-backup[do not save backup copies of files]' \ | |
449 | '*:file:_files -W $(_hg_cmd root)' |
|
431 | '*:file:_files -W $(_hg_cmd root)' | |
450 | } |
|
432 | } | |
451 |
|
433 | |||
452 | _hg_cmd_serve() { |
|
434 | _hg_cmd_serve() { | |
453 | _arguments -s -w : $_hg_global_opts \ |
|
435 | _arguments -s -w : $_hg_global_opts \ | |
454 | '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \ |
|
436 | '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \ | |
455 | '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \ |
|
437 | '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \ | |
456 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ |
|
438 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ | |
457 | '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ |
|
439 | '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ | |
458 | '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ |
|
440 | '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ | |
459 | '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \ |
|
441 | '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \ | |
460 | '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ |
|
442 | '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ | |
461 | '--style[web template style]:style' \ |
|
443 | '--style[web template style]:style' \ | |
462 | '--stdio[for remote clients]' \ |
|
444 | '--stdio[for remote clients]' \ | |
463 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' |
|
445 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' | |
464 | } |
|
446 | } | |
465 |
|
447 | |||
466 | _hg_cmd_status() { |
|
448 | _hg_cmd_status() { | |
467 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
449 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
468 | '(--all -A)'{-A,--all}'[show status of all files]' \ |
|
450 | '(--all -A)'{-A,--all}'[show status of all files]' \ | |
469 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ |
|
451 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ | |
470 | '(--added -a)'{-a,--added}'[show only added files]' \ |
|
452 | '(--added -a)'{-a,--added}'[show only added files]' \ | |
471 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ |
|
453 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ | |
472 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ |
|
454 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ | |
473 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ |
|
455 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ | |
474 | '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ |
|
456 | '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ | |
475 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ |
|
457 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ | |
476 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ |
|
458 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ | |
477 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ |
|
459 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ | |
478 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ |
|
460 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ | |
479 | '--rev[show difference from revision]:revision:_hg_tags' \ |
|
461 | '--rev[show difference from revision]:revision:_hg_tags' \ | |
480 | '*:files:_files' |
|
462 | '*:files:_files' | |
481 | } |
|
463 | } | |
482 |
|
464 | |||
483 | _hg_cmd_tag() { |
|
465 | _hg_cmd_tag() { | |
484 | _arguments -s -w : $_hg_global_opts \ |
|
466 | _arguments -s -w : $_hg_global_opts \ | |
485 | '(--local -l)'{-l,--local}'[make the tag local]' \ |
|
467 | '(--local -l)'{-l,--local}'[make the tag local]' \ | |
486 | '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ |
|
468 | '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ | |
487 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
469 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
488 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
470 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
489 | '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \ |
|
471 | '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \ | |
490 | ':tag name:' |
|
472 | ':tag name:' | |
491 | } |
|
473 | } | |
492 |
|
474 | |||
493 | _hg_cmd_tip() { |
|
475 | _hg_cmd_tip() { | |
494 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
476 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
495 | '(--patch -p)'{-p,--patch}'[show patch]' |
|
477 | '(--patch -p)'{-p,--patch}'[show patch]' | |
496 | } |
|
478 | } | |
497 |
|
479 | |||
498 | _hg_cmd_unbundle() { |
|
480 | _hg_cmd_unbundle() { | |
499 | _arguments -s -w : $_hg_global_opts \ |
|
481 | _arguments -s -w : $_hg_global_opts \ | |
500 | '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ |
|
482 | '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ | |
501 | ':files:_files' |
|
483 | ':files:_files' | |
502 | } |
|
484 | } | |
503 |
|
485 | |||
504 | _hg_cmd_update() { |
|
486 | _hg_cmd_update() { | |
505 | _arguments -s -w : $_hg_global_opts \ |
|
487 | _arguments -s -w : $_hg_global_opts \ | |
506 | '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ |
|
488 | '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ | |
507 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ |
|
489 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ | |
508 | ':revision:_hg_tags' |
|
490 | ':revision:_hg_tags' | |
509 | } |
|
491 | } | |
510 |
|
492 | |||
511 | # HGK |
|
493 | # HGK | |
512 | _hg_cmd_view() { |
|
494 | _hg_cmd_view() { | |
513 | _arguments -s -w : $_hg_global_opts \ |
|
495 | _arguments -s -w : $_hg_global_opts \ | |
514 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
|
496 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | |
515 | ':revision range:_hg_tags' |
|
497 | ':revision range:_hg_tags' | |
516 | } |
|
498 | } | |
517 |
|
499 | |||
518 | # MQ |
|
500 | # MQ | |
|
501 | _hg_qseries() { | |||
|
502 | typeset -a patches | |||
|
503 | patches=($(_hg_cmd qseries)) | |||
|
504 | (( $#patches )) && _describe -t hg-patches 'patches' patches | |||
|
505 | } | |||
|
506 | ||||
|
507 | _hg_qapplied() { | |||
|
508 | typeset -a patches | |||
|
509 | patches=($(_hg_cmd qapplied)) | |||
|
510 | (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches | |||
|
511 | } | |||
|
512 | ||||
|
513 | _hg_qunapplied() { | |||
|
514 | typeset -a patches | |||
|
515 | patches=($(_hg_cmd qunapplied)) | |||
|
516 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches | |||
|
517 | } | |||
|
518 | ||||
|
519 | _hg_qguards() { | |||
|
520 | typeset -a guards | |||
|
521 | local guard | |||
|
522 | _hg_cmd qselect -s | while read guard | |||
|
523 | do | |||
|
524 | guards+=(${guard#(+|-)}) | |||
|
525 | done | |||
|
526 | (( $#guards )) && _describe -t hg-guards 'guards' guards | |||
|
527 | } | |||
|
528 | ||||
|
529 | _hg_qseries_opts=( | |||
|
530 | '(--summary -s)'{-s,--summary}'[print first line of patch header]') | |||
|
531 | ||||
|
532 | _hg_cmd_qapplied() { | |||
|
533 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |||
|
534 | } | |||
|
535 | ||||
519 | _hg_cmd_qdelete() { |
|
536 | _hg_cmd_qdelete() { | |
520 | _arguments -s -w : $_hg_global_opts \ |
|
537 | _arguments -s -w : $_hg_global_opts \ | |
521 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ |
|
538 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ | |
522 | '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \ |
|
539 | '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \ | |
523 | '*:patch:_hg_qunapplied' |
|
540 | '*:unapplied patch:_hg_qunapplied' | |
|
541 | } | |||
|
542 | ||||
|
543 | _hg_cmd_qdiff() { | |||
|
544 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |||
|
545 | '*:pattern:_files -W $(_hg_cmd root)' | |||
|
546 | } | |||
|
547 | ||||
|
548 | _hg_cmd_qfold() { | |||
|
549 | _arguments -s -w : $_hg_global_opts $_h_commit_opts \ | |||
|
550 | '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ | |||
|
551 | '*:unapplied patch:_hg_qunapplied' | |||
|
552 | } | |||
|
553 | ||||
|
554 | _hg_cmd_qguard() { | |||
|
555 | _arguments -s -w : $_hg_global_opts \ | |||
|
556 | '(--list -l)'{-l,--list}'[list all patches and guards]' \ | |||
|
557 | '(--none -n)'{-n,--none}'[drop all guards]' \ | |||
|
558 | ':patch:_hg_qseries' \ | |||
|
559 | '*:guards:_hg_qguards' | |||
524 | } |
|
560 | } | |
525 |
|
561 | |||
526 | _hg_cmd_qheader() { |
|
562 | _hg_cmd_qheader() { | |
527 | _arguments -s -w : $_hg_global_opts \ |
|
563 | _arguments -s -w : $_hg_global_opts \ | |
528 | ':patch:_hg_qseries' |
|
564 | ':patch:_hg_qseries' | |
529 | } |
|
565 | } | |
530 |
|
566 | |||
|
567 | _hg_cmd_qimport() { | |||
|
568 | _arguments -s -w : $_hg_global_opts \ | |||
|
569 | '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ | |||
|
570 | '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ | |||
|
571 | '(--force -f)'{-f,--force}'[overwrite existing files]' \ | |||
|
572 | '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \ | |||
|
573 | '*:patch:_files' | |||
|
574 | } | |||
|
575 | ||||
531 | _hg_cmd_qnew() { |
|
576 | _hg_cmd_qnew() { | |
532 | _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ |
|
577 | _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ | |
533 | '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ |
|
578 | '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ | |
534 | ':patch:' |
|
579 | ':patch:' | |
535 | } |
|
580 | } | |
536 |
|
581 | |||
|
582 | _hg_cmd_qnext() { | |||
|
583 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |||
|
584 | } | |||
|
585 | ||||
537 | _hg_cmd_qpop() { |
|
586 | _hg_cmd_qpop() { | |
538 | _arguments -s -w : $_hg_global_opts \ |
|
587 | _arguments -s -w : $_hg_global_opts \ | |
539 | '(--all -a :)'{-a,--all}'[pop all patches]' \ |
|
588 | '(--all -a :)'{-a,--all}'[pop all patches]' \ | |
540 | '(--name -n)'{-n+,--name}'[queue name to pop]:' \ |
|
589 | '(--name -n)'{-n+,--name}'[queue name to pop]:' \ | |
541 | '(--force -f)'{-f,--force}'[forget any local changes]' \ |
|
590 | '(--force -f)'{-f,--force}'[forget any local changes]' \ | |
542 | ':patch:_hg_qapplied' |
|
591 | ':patch:_hg_qapplied' | |
543 | } |
|
592 | } | |
544 |
|
593 | |||
|
594 | _hg_cmd_qprev() { | |||
|
595 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |||
|
596 | } | |||
|
597 | ||||
545 | _hg_cmd_qpush() { |
|
598 | _hg_cmd_qpush() { | |
546 | _arguments -s -w : $_hg_global_opts \ |
|
599 | _arguments -s -w : $_hg_global_opts \ | |
547 | '(--all -a :)'{-a,--all}'[apply all patches]' \ |
|
600 | '(--all -a :)'{-a,--all}'[apply all patches]' \ | |
548 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ |
|
601 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ | |
549 | '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ |
|
602 | '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ | |
550 | '(--name -n)'{-n+,--name}'[merge queue name]:' \ |
|
603 | '(--name -n)'{-n+,--name}'[merge queue name]:' \ | |
551 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ |
|
604 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ | |
552 | ':patch:_hg_qunapplied' |
|
605 | ':patch:_hg_qunapplied' | |
553 | } |
|
606 | } | |
554 |
|
607 | |||
555 | _hg_cmd_qrefresh() { |
|
608 | _hg_cmd_qrefresh() { | |
556 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ |
|
609 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ | |
557 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ |
|
610 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ | |
558 | '(--short -s)'{-s,--short}'[short refresh]' \ |
|
611 | '(--short -s)'{-s,--short}'[short refresh]' \ | |
559 | '*:files:_files -W $(_hg_cmd root)' |
|
612 | '*:files:_files -W $(_hg_cmd root)' | |
560 | } |
|
613 | } | |
561 |
|
614 | |||
|
615 | _hg_cmd_qrename() { | |||
|
616 | _arguments -s -w : $_hg_global_opts \ | |||
|
617 | ':patch:_hg_qseries' \ | |||
|
618 | ':destination:' | |||
|
619 | } | |||
|
620 | ||||
|
621 | _hg_cmd_qselect() { | |||
|
622 | _arguments -s -w : $_hg_global_opts \ | |||
|
623 | '(--none -n :)'{-n,--none}'[disable all guards]' \ | |||
|
624 | '(--series -s :)'{-s,--series}'[list all guards in series file]' \ | |||
|
625 | '--pop[pop to before first guarded applied patch]' \ | |||
|
626 | '--reapply[pop and reapply patches]' \ | |||
|
627 | '*:guards:_hg_qguards' | |||
|
628 | } | |||
|
629 | ||||
|
630 | _hg_cmd_qseries() { | |||
|
631 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \ | |||
|
632 | '(--missing -m)'{-m,--missing}'[print patches not in series]' | |||
|
633 | } | |||
|
634 | ||||
|
635 | _hg_cmd_qunapplied() { | |||
|
636 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |||
|
637 | } | |||
|
638 | ||||
|
639 | _hg_cmd_qtop() { | |||
|
640 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |||
|
641 | } | |||
|
642 | ||||
562 | _hg_cmd_strip() { |
|
643 | _hg_cmd_strip() { | |
563 | _arguments -s -w : $_hg_global_opts \ |
|
644 | _arguments -s -w : $_hg_global_opts \ | |
564 | '(--force -f)'{-f,--force}'[force multi-head removal]' \ |
|
645 | '(--force -f)'{-f,--force}'[force multi-head removal]' \ | |
565 | '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ |
|
646 | '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ | |
566 | '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ |
|
647 | '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ | |
567 | ':revision:_hg_tags' |
|
648 | ':revision:_hg_tags' | |
568 | } |
|
649 | } | |
569 |
|
650 | |||
570 | _hg "$@" |
|
651 | _hg "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now