Show More
@@ -1,651 +1,652 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 | # Common options |
|
167 | # Common options | |
168 | _hg_global_opts=( |
|
168 | _hg_global_opts=( | |
169 | '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' |
|
169 | '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' | |
170 | '--cwd[change working directory]:new working directory:_files -/' |
|
170 | '--cwd[change working directory]:new working directory:_files -/' | |
171 | '(--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]' | |
172 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' |
|
172 | '(--verbose -v)'{-v,--verbose}'[enable additional output]' | |
173 | '(--quiet -q)'{-q,--quiet}'[suppress output]' |
|
173 | '(--quiet -q)'{-q,--quiet}'[suppress output]' | |
174 | '(--help -h)'{-h,--help}'[display help and exit]' |
|
174 | '(--help -h)'{-h,--help}'[display help and exit]' | |
175 | '--debug[debug mode]' |
|
175 | '--debug[debug mode]' | |
176 | '--debugger[start debugger]' |
|
176 | '--debugger[start debugger]' | |
177 | '--traceback[print traceback on exception]' |
|
177 | '--traceback[print traceback on exception]' | |
178 | '--time[time how long the command takes]' |
|
178 | '--time[time how long the command takes]' | |
179 | '--profile[profile]' |
|
179 | '--profile[profile]' | |
180 | '--version[output version information and exit]' |
|
180 | '--version[output version information and exit]' | |
181 | ) |
|
181 | ) | |
182 |
|
182 | |||
183 | _hg_pat_opts=( |
|
183 | _hg_pat_opts=( | |
184 | '*'{-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) -/' | |
185 | '*'{-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) -/') | |
186 |
|
186 | |||
187 | _hg_diff_opts=( |
|
187 | _hg_diff_opts=( | |
188 | '(--text -a)'{-a,--text}'[treat all files as text]' |
|
188 | '(--text -a)'{-a,--text}'[treat all files as text]' | |
189 | '(--git -g)'{-g,--git}'[use git extended diff format]' |
|
189 | '(--git -g)'{-g,--git}'[use git extended diff format]' | |
190 | "--nodates[don't include dates in diff headers]") |
|
190 | "--nodates[don't include dates in diff headers]") | |
191 |
|
191 | |||
192 | _hg_dryrun_opts=( |
|
192 | _hg_dryrun_opts=( | |
193 | '(--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]') | |
194 |
|
194 | |||
195 | _hg_style_opts=( |
|
195 | _hg_style_opts=( | |
196 | '--style[display using template map file]:' |
|
196 | '--style[display using template map file]:' | |
197 | '--template[display with template]:') |
|
197 | '--template[display with template]:') | |
198 |
|
198 | |||
199 | _hg_commit_opts=( |
|
199 | _hg_commit_opts=( | |
200 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' |
|
200 | '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' | |
201 | '(-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:' | |
202 | '(-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') | |
203 |
|
203 | |||
204 | _hg_remote_opts=( |
|
204 | _hg_remote_opts=( | |
205 | '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' |
|
205 | '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' | |
206 | '--remotecmd[specify hg command to run on the remote side]:') |
|
206 | '--remotecmd[specify hg command to run on the remote side]:') | |
207 |
|
207 | |||
208 | _hg_cmd() { |
|
208 | _hg_cmd() { | |
209 | _call_program hg hg "$_hg_cmd_globals[@]" "$@" |
|
209 | _call_program hg hg "$_hg_cmd_globals[@]" "$@" | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 | _hg_cmd_add() { |
|
212 | _hg_cmd_add() { | |
213 | _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 \ | |
214 | '*:unknown files:_hg_unknown' |
|
214 | '*:unknown files:_hg_unknown' | |
215 | } |
|
215 | } | |
216 |
|
216 | |||
217 | _hg_cmd_addremove() { |
|
217 | _hg_cmd_addremove() { | |
218 | _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 \ | |
219 | '(--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)]:' \ | |
220 | '*:unknown or missing files:_hg_addremove' |
|
220 | '*:unknown or missing files:_hg_addremove' | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
223 | _hg_cmd_annotate() { |
|
223 | _hg_cmd_annotate() { | |
224 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
224 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
225 | '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \ |
|
225 | '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \ | |
226 | '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ |
|
226 | '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ | |
227 | '(--text -a)'{-a,--text}'[treat all files as text]' \ |
|
227 | '(--text -a)'{-a,--text}'[treat all files as text]' \ | |
228 | '(--user -u)'{-u,--user}'[list the author]' \ |
|
228 | '(--user -u)'{-u,--user}'[list the author]' \ | |
229 | '(--date -d)'{-d,--date}'[list the date]' \ |
|
229 | '(--date -d)'{-d,--date}'[list the date]' \ | |
230 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ |
|
230 | '(--number -n)'{-n,--number}'[list the revision number (default)]' \ | |
231 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ |
|
231 | '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ | |
232 | '*:files:_files -W $(_hg_cmd root)' |
|
232 | '*:files:_files -W $(_hg_cmd root)' | |
233 | } |
|
233 | } | |
234 |
|
234 | |||
235 | _hg_cmd_archive() { |
|
235 | _hg_cmd_archive() { | |
236 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
236 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
237 | '--no-decode[do not pass files through decoders]' \ |
|
237 | '--no-decode[do not pass files through decoders]' \ | |
238 | '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ |
|
238 | '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ | |
239 | '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \ |
|
239 | '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \ | |
240 | '(--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)' \ | |
241 | '*:destination:_files' |
|
241 | '*:destination:_files' | |
242 | } |
|
242 | } | |
243 |
|
243 | |||
244 | _hg_cmd_bundle() { |
|
244 | _hg_cmd_bundle() { | |
245 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
245 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
246 | '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ |
|
246 | '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ | |
247 | '(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' \ | |
248 | ':output file:_files' \ |
|
248 | ':output file:_files' \ | |
249 | ':destination repository:_files -/' |
|
249 | ':destination repository:_files -/' | |
250 | } |
|
250 | } | |
251 |
|
251 | |||
252 | _hg_cmd_cat() { |
|
252 | _hg_cmd_cat() { | |
253 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
253 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
254 | '(--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:' \ | |
255 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ |
|
255 | '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ | |
256 | '*:file:_files -W $(_hg_cmd root)' |
|
256 | '*:file:_files -W $(_hg_cmd root)' | |
257 | } |
|
257 | } | |
258 |
|
258 | |||
259 | _hg_cmd_clone() { |
|
259 | _hg_cmd_clone() { | |
260 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
260 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
261 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ |
|
261 | '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ | |
262 | '(--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]:' \ | |
263 | '--uncompressed[use uncompressed transfer (fast over LAN)]' \ |
|
263 | '--uncompressed[use uncompressed transfer (fast over LAN)]' \ | |
264 | ':source repository:_hg_remote' \ |
|
264 | ':source repository:_hg_remote' \ | |
265 | ':destination:_files -/' |
|
265 | ':destination:_files -/' | |
266 | } |
|
266 | } | |
267 |
|
267 | |||
268 | _hg_cmd_commit() { |
|
268 | _hg_cmd_commit() { | |
269 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
269 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
270 | '(--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]' | |
271 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
271 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
272 | '(--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' \ | |
273 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
273 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
274 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
274 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
275 | '*:file:_files -W $(_hg_cmd root)' |
|
275 | '*:file:_files -W $(_hg_cmd root)' | |
276 | } |
|
276 | } | |
277 |
|
277 | |||
278 | _hg_cmd_copy() { |
|
278 | _hg_cmd_copy() { | |
279 | _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 \ | |
280 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ |
|
280 | '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ | |
281 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
281 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ | |
282 | '*:file:_files -W $(_hg_cmd root)' |
|
282 | '*:file:_files -W $(_hg_cmd root)' | |
283 | } |
|
283 | } | |
284 |
|
284 | |||
285 | _hg_cmd_diff() { |
|
285 | _hg_cmd_diff() { | |
286 | _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 \ | |
287 | '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \ |
|
287 | '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \ | |
288 | '(--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]' \ | |
289 | '(--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]' \ | |
290 | '(--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]' \ | |
291 | '(--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]' \ | |
292 | '*:file:_files -W $(_hg_cmd root)' |
|
292 | '*:file:_files -W $(_hg_cmd root)' | |
293 | } |
|
293 | } | |
294 |
|
294 | |||
295 | _hg_cmd_export() { |
|
295 | _hg_cmd_export() { | |
296 | _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ |
|
296 | _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ | |
297 | '(--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:' \ | |
298 | '--switch-parent[diff against the second parent]' \ |
|
298 | '--switch-parent[diff against the second parent]' \ | |
299 | '*:revision:_hg_tags' |
|
299 | '*:revision:_hg_tags' | |
300 | } |
|
300 | } | |
301 |
|
301 | |||
302 | _hg_cmd_grep() { |
|
302 | _hg_cmd_grep() { | |
303 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
303 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
304 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ |
|
304 | '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ | |
305 | '--all[print all revisions with matches]' \ |
|
305 | '--all[print all revisions with matches]' \ | |
306 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ |
|
306 | '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ | |
307 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ |
|
307 | '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ | |
308 | '(--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]' \ | |
309 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ |
|
309 | '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ | |
310 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \ |
|
310 | '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \ | |
311 | '(--user -u)'{-u,--user}'[print user who committed change]' \ |
|
311 | '(--user -u)'{-u,--user}'[print user who committed change]' \ | |
312 | '*:search pattern:_files -W $(_hg_cmd root)' |
|
312 | '*:search pattern:_files -W $(_hg_cmd root)' | |
313 | } |
|
313 | } | |
314 |
|
314 | |||
315 | _hg_cmd_heads() { |
|
315 | _hg_cmd_heads() { | |
316 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
316 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
317 | '(--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' | |
318 | } |
|
318 | } | |
319 |
|
319 | |||
320 | _hg_cmd_help() { |
|
320 | _hg_cmd_help() { | |
321 | _arguments -s -w : $_hg_global_opts \ |
|
321 | _arguments -s -w : $_hg_global_opts \ | |
322 | '*:mercurial command:_hg_commands' |
|
322 | '*:mercurial command:_hg_commands' | |
323 | } |
|
323 | } | |
324 |
|
324 | |||
325 | _hg_cmd_import() { |
|
325 | _hg_cmd_import() { | |
326 | _arguments -s -w : $_hg_global_opts \ |
|
326 | _arguments -s -w : $_hg_global_opts \ | |
327 | '(--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:' \ | |
328 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ |
|
328 | '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ | |
329 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ |
|
329 | '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ | |
330 | '*:patch:_files' |
|
330 | '*:patch:_files' | |
331 | } |
|
331 | } | |
332 |
|
332 | |||
333 | _hg_cmd_incoming() { |
|
333 | _hg_cmd_incoming() { | |
334 | _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 \ | |
335 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ |
|
335 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ | |
336 | '(--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]' \ | |
337 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
337 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
338 | '(--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]' \ | |
339 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
339 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ | |
340 | '--bundle[file to store the bundles into]:bundle file:_files' \ |
|
340 | '--bundle[file to store the bundles into]:bundle file:_files' \ | |
341 | ':source:_hg_remote' |
|
341 | ':source:_hg_remote' | |
342 | } |
|
342 | } | |
343 |
|
343 | |||
344 | _hg_cmd_init() { |
|
344 | _hg_cmd_init() { | |
345 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
345 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
346 | ':dir:_files -/' |
|
346 | ':dir:_files -/' | |
347 | } |
|
347 | } | |
348 |
|
348 | |||
349 | _hg_cmd_locate() { |
|
349 | _hg_cmd_locate() { | |
350 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
350 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
351 | '(--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' \ | |
352 | '(--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]' \ | |
353 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ |
|
353 | '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ | |
354 | '*:search pattern:_files -W $(_hg_cmd root)' |
|
354 | '*:search pattern:_files -W $(_hg_cmd root)' | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | _hg_cmd_log() { |
|
357 | _hg_cmd_log() { | |
358 | _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 \ | |
359 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ |
|
359 | '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ | |
360 | '(-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]' \ | |
361 | '(--copies -C)'{-C,--copies}'[show copied files]' \ |
|
361 | '(--copies -C)'{-C,--copies}'[show copied files]' \ | |
362 | '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ |
|
362 | '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ | |
363 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
|
363 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | |
364 | '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \ |
|
364 | '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \ | |
365 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ |
|
365 | '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ | |
366 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ |
|
366 | '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ | |
367 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
367 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
368 | '(--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' \ | |
369 | '*:files:_files -W $(_hg_cmd root)' |
|
369 | '*:files:_files -W $(_hg_cmd root)' | |
370 | } |
|
370 | } | |
371 |
|
371 | |||
372 | _hg_cmd_manifest() { |
|
372 | _hg_cmd_manifest() { | |
373 | _arguments -s -w : $_hg_global_opts \ |
|
373 | _arguments -s -w : $_hg_global_opts \ | |
374 | ':revision:_hg_tags' |
|
374 | ':revision:_hg_tags' | |
375 | } |
|
375 | } | |
376 |
|
376 | |||
377 | _hg_cmd_outgoing() { |
|
377 | _hg_cmd_outgoing() { | |
378 | _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 \ | |
379 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ |
|
379 | '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ | |
380 | '(--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]' \ | |
381 | '(--patch -p)'{-p,--patch}'[show patch]' \ |
|
381 | '(--patch -p)'{-p,--patch}'[show patch]' \ | |
382 | '(--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]' \ | |
383 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ |
|
383 | '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ | |
384 | ':destination:_hg_remote' |
|
384 | ':destination:_hg_remote' | |
385 | } |
|
385 | } | |
386 |
|
386 | |||
387 | _hg_cmd_parents() { |
|
387 | _hg_cmd_parents() { | |
388 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
388 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
389 | '(--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' \ | |
390 | ':revision:_hg_tags' |
|
390 | ':revision:_hg_tags' | |
391 | } |
|
391 | } | |
392 |
|
392 | |||
393 | _hg_cmd_paths() { |
|
393 | _hg_cmd_paths() { | |
394 | _arguments -s -w : $_hg_global_opts \ |
|
394 | _arguments -s -w : $_hg_global_opts \ | |
395 | ':path:_hg_paths' |
|
395 | ':path:_hg_paths' | |
396 | } |
|
396 | } | |
397 |
|
397 | |||
398 | _hg_cmd_pull() { |
|
398 | _hg_cmd_pull() { | |
399 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
399 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
400 | '(--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]' \ | |
401 | '(--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]' \ | |
402 | ':source:_hg_remote' |
|
402 | ':source:_hg_remote' | |
403 | } |
|
403 | } | |
404 |
|
404 | |||
405 | _hg_cmd_push() { |
|
405 | _hg_cmd_push() { | |
406 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ |
|
406 | _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ | |
407 | '(--force -f)'{-f,--force}'[force push]' \ |
|
407 | '(--force -f)'{-f,--force}'[force push]' \ | |
408 | '(--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]' \ | |
409 | ':destination:_hg_remote' |
|
409 | ':destination:_hg_remote' | |
410 | } |
|
410 | } | |
411 |
|
411 | |||
412 | _hg_cmd_remove() { |
|
412 | _hg_cmd_remove() { | |
413 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
413 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
414 | '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ |
|
414 | '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ | |
415 | '(--force -f)'{-f,--force}'[remove file even if modified]' \ |
|
415 | '(--force -f)'{-f,--force}'[remove file even if modified]' \ | |
416 | '*:file:_files -W $(_hg_cmd root)' |
|
416 | '*:file:_files -W $(_hg_cmd root)' | |
417 | } |
|
417 | } | |
418 |
|
418 | |||
419 | _hg_cmd_rename() { |
|
419 | _hg_cmd_rename() { | |
420 | _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 \ | |
421 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ |
|
421 | '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ | |
422 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ |
|
422 | '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ | |
423 | '*:file:_files -W $(_hg_cmd root)' |
|
423 | '*:file:_files -W $(_hg_cmd root)' | |
424 | } |
|
424 | } | |
425 |
|
425 | |||
426 | _hg_cmd_revert() { |
|
426 | _hg_cmd_revert() { | |
427 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ |
|
427 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ | |
428 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ |
|
428 | '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ | |
429 | '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ |
|
429 | '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ | |
430 | '--no-backup[do not save backup copies of files]' \ |
|
430 | '--no-backup[do not save backup copies of files]' \ | |
431 | '*:file:_files -W $(_hg_cmd root)' |
|
431 | '*:file:_files -W $(_hg_cmd root)' | |
432 | } |
|
432 | } | |
433 |
|
433 | |||
434 | _hg_cmd_serve() { |
|
434 | _hg_cmd_serve() { | |
435 | _arguments -s -w : $_hg_global_opts \ |
|
435 | _arguments -s -w : $_hg_global_opts \ | |
436 | '(--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' \ | |
437 | '(--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' \ | |
438 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ |
|
438 | '(--daemon -d)'{-d,--daemon}'[run server in background]' \ | |
439 | '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ |
|
439 | '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ | |
440 | '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ |
|
440 | '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ | |
441 | '(--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:' \ | |
442 | '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ |
|
442 | '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ | |
443 | '--style[web template style]:style' \ |
|
443 | '--style[web template style]:style' \ | |
444 | '--stdio[for remote clients]' \ |
|
444 | '--stdio[for remote clients]' \ | |
445 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' |
|
445 | '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | _hg_cmd_status() { |
|
448 | _hg_cmd_status() { | |
449 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
449 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
450 | '(--all -A)'{-A,--all}'[show status of all files]' \ |
|
450 | '(--all -A)'{-A,--all}'[show status of all files]' \ | |
451 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ |
|
451 | '(--modified -m)'{-m,--modified}'[show only modified files]' \ | |
452 | '(--added -a)'{-a,--added}'[show only added files]' \ |
|
452 | '(--added -a)'{-a,--added}'[show only added files]' \ | |
453 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ |
|
453 | '(--removed -r)'{-r,--removed}'[show only removed files]' \ | |
454 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ |
|
454 | '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ | |
455 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ |
|
455 | '(--clean -c)'{-c,--clean}'[show only files without changes]' \ | |
456 | '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ |
|
456 | '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ | |
457 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ |
|
457 | '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ | |
458 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ |
|
458 | '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ | |
459 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ |
|
459 | '(--copies -C)'{-C,--copies}'[show source of copied files]' \ | |
460 | '(--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]' \ | |
461 | '--rev[show difference from revision]:revision:_hg_tags' \ |
|
461 | '--rev[show difference from revision]:revision:_hg_tags' \ | |
462 | '*:files:_files' |
|
462 | '*:files:_files' | |
463 | } |
|
463 | } | |
464 |
|
464 | |||
465 | _hg_cmd_tag() { |
|
465 | _hg_cmd_tag() { | |
466 | _arguments -s -w : $_hg_global_opts \ |
|
466 | _arguments -s -w : $_hg_global_opts \ | |
467 | '(--local -l)'{-l,--local}'[make the tag local]' \ |
|
467 | '(--local -l)'{-l,--local}'[make the tag local]' \ | |
468 | '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ |
|
468 | '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ | |
469 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ |
|
469 | '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ | |
470 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ |
|
470 | '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ | |
471 | '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \ |
|
471 | '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \ | |
472 | ':tag name:' |
|
472 | ':tag name:' | |
473 | } |
|
473 | } | |
474 |
|
474 | |||
475 | _hg_cmd_tip() { |
|
475 | _hg_cmd_tip() { | |
476 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ |
|
476 | _arguments -s -w : $_hg_global_opts $_hg_style_opts \ | |
477 | '(--patch -p)'{-p,--patch}'[show patch]' |
|
477 | '(--patch -p)'{-p,--patch}'[show patch]' | |
478 | } |
|
478 | } | |
479 |
|
479 | |||
480 | _hg_cmd_unbundle() { |
|
480 | _hg_cmd_unbundle() { | |
481 | _arguments -s -w : $_hg_global_opts \ |
|
481 | _arguments -s -w : $_hg_global_opts \ | |
482 | '(--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]' \ | |
483 | ':files:_files' |
|
483 | ':files:_files' | |
484 | } |
|
484 | } | |
485 |
|
485 | |||
486 | _hg_cmd_update() { |
|
486 | _hg_cmd_update() { | |
487 | _arguments -s -w : $_hg_global_opts \ |
|
487 | _arguments -s -w : $_hg_global_opts \ | |
488 | '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ |
|
488 | '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ | |
489 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ |
|
489 | '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ | |
490 | ':revision:_hg_tags' |
|
490 | ':revision:_hg_tags' | |
491 | } |
|
491 | } | |
492 |
|
492 | |||
493 | # HGK |
|
493 | # HGK | |
494 | _hg_cmd_view() { |
|
494 | _hg_cmd_view() { | |
495 | _arguments -s -w : $_hg_global_opts \ |
|
495 | _arguments -s -w : $_hg_global_opts \ | |
496 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
|
496 | '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | |
497 | ':revision range:_hg_tags' |
|
497 | ':revision range:_hg_tags' | |
498 | } |
|
498 | } | |
499 |
|
499 | |||
500 | # MQ |
|
500 | # MQ | |
501 | _hg_qseries() { |
|
501 | _hg_qseries() { | |
502 | typeset -a patches |
|
502 | typeset -a patches | |
503 | patches=($(_hg_cmd qseries)) |
|
503 | patches=($(_hg_cmd qseries)) | |
504 | (( $#patches )) && _describe -t hg-patches 'patches' patches |
|
504 | (( $#patches )) && _describe -t hg-patches 'patches' patches | |
505 | } |
|
505 | } | |
506 |
|
506 | |||
507 | _hg_qapplied() { |
|
507 | _hg_qapplied() { | |
508 | typeset -a patches |
|
508 | typeset -a patches | |
509 | patches=($(_hg_cmd qapplied)) |
|
509 | patches=($(_hg_cmd qapplied)) | |
510 | (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches |
|
510 | (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches | |
511 | } |
|
511 | } | |
512 |
|
512 | |||
513 | _hg_qunapplied() { |
|
513 | _hg_qunapplied() { | |
514 | typeset -a patches |
|
514 | typeset -a patches | |
515 | patches=($(_hg_cmd qunapplied)) |
|
515 | patches=($(_hg_cmd qunapplied)) | |
516 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches |
|
516 | (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches | |
517 | } |
|
517 | } | |
518 |
|
518 | |||
519 | _hg_qguards() { |
|
519 | _hg_qguards() { | |
520 | typeset -a guards |
|
520 | typeset -a guards | |
521 | local guard |
|
521 | local guard | |
|
522 | compset -P "+|-" | |||
522 | _hg_cmd qselect -s | while read guard |
|
523 | _hg_cmd qselect -s | while read guard | |
523 | do |
|
524 | do | |
524 | guards+=(${guard#(+|-)}) |
|
525 | guards+=(${guard#(+|-)}) | |
525 | done |
|
526 | done | |
526 | (( $#guards )) && _describe -t hg-guards 'guards' guards |
|
527 | (( $#guards )) && _describe -t hg-guards 'guards' guards | |
527 | } |
|
528 | } | |
528 |
|
529 | |||
529 | _hg_qseries_opts=( |
|
530 | _hg_qseries_opts=( | |
530 | '(--summary -s)'{-s,--summary}'[print first line of patch header]') |
|
531 | '(--summary -s)'{-s,--summary}'[print first line of patch header]') | |
531 |
|
532 | |||
532 | _hg_cmd_qapplied() { |
|
533 | _hg_cmd_qapplied() { | |
533 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
534 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
534 | } |
|
535 | } | |
535 |
|
536 | |||
536 | _hg_cmd_qdelete() { |
|
537 | _hg_cmd_qdelete() { | |
537 | _arguments -s -w : $_hg_global_opts \ |
|
538 | _arguments -s -w : $_hg_global_opts \ | |
538 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ |
|
539 | '(--keep -k)'{-k,--keep}'[keep patch file]' \ | |
539 | '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \ |
|
540 | '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \ | |
540 | '*:unapplied patch:_hg_qunapplied' |
|
541 | '*:unapplied patch:_hg_qunapplied' | |
541 | } |
|
542 | } | |
542 |
|
543 | |||
543 | _hg_cmd_qdiff() { |
|
544 | _hg_cmd_qdiff() { | |
544 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
|
545 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | |
545 | '*:pattern:_files -W $(_hg_cmd root)' |
|
546 | '*:pattern:_files -W $(_hg_cmd root)' | |
546 | } |
|
547 | } | |
547 |
|
548 | |||
548 | _hg_cmd_qfold() { |
|
549 | _hg_cmd_qfold() { | |
549 | _arguments -s -w : $_hg_global_opts $_h_commit_opts \ |
|
550 | _arguments -s -w : $_hg_global_opts $_h_commit_opts \ | |
550 | '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ |
|
551 | '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ | |
551 | '*:unapplied patch:_hg_qunapplied' |
|
552 | '*:unapplied patch:_hg_qunapplied' | |
552 | } |
|
553 | } | |
553 |
|
554 | |||
554 | _hg_cmd_qguard() { |
|
555 | _hg_cmd_qguard() { | |
555 | _arguments -s -w : $_hg_global_opts \ |
|
556 | _arguments -s -w : $_hg_global_opts \ | |
556 | '(--list -l)'{-l,--list}'[list all patches and guards]' \ |
|
557 | '(--list -l)'{-l,--list}'[list all patches and guards]' \ | |
557 | '(--none -n)'{-n,--none}'[drop all guards]' \ |
|
558 | '(--none -n)'{-n,--none}'[drop all guards]' \ | |
558 | ':patch:_hg_qseries' \ |
|
559 | ':patch:_hg_qseries' \ | |
559 | '*:guards:_hg_qguards' |
|
560 | '*:guards:_hg_qguards' | |
560 | } |
|
561 | } | |
561 |
|
562 | |||
562 | _hg_cmd_qheader() { |
|
563 | _hg_cmd_qheader() { | |
563 | _arguments -s -w : $_hg_global_opts \ |
|
564 | _arguments -s -w : $_hg_global_opts \ | |
564 | ':patch:_hg_qseries' |
|
565 | ':patch:_hg_qseries' | |
565 | } |
|
566 | } | |
566 |
|
567 | |||
567 | _hg_cmd_qimport() { |
|
568 | _hg_cmd_qimport() { | |
568 | _arguments -s -w : $_hg_global_opts \ |
|
569 | _arguments -s -w : $_hg_global_opts \ | |
569 | '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ |
|
570 | '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ | |
570 | '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ |
|
571 | '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ | |
571 | '(--force -f)'{-f,--force}'[overwrite existing files]' \ |
|
572 | '(--force -f)'{-f,--force}'[overwrite existing files]' \ | |
572 | '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \ |
|
573 | '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \ | |
573 | '*:patch:_files' |
|
574 | '*:patch:_files' | |
574 | } |
|
575 | } | |
575 |
|
576 | |||
576 | _hg_cmd_qnew() { |
|
577 | _hg_cmd_qnew() { | |
577 | _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ |
|
578 | _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ | |
578 | '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ |
|
579 | '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ | |
579 | ':patch:' |
|
580 | ':patch:' | |
580 | } |
|
581 | } | |
581 |
|
582 | |||
582 | _hg_cmd_qnext() { |
|
583 | _hg_cmd_qnext() { | |
583 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
584 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
584 | } |
|
585 | } | |
585 |
|
586 | |||
586 | _hg_cmd_qpop() { |
|
587 | _hg_cmd_qpop() { | |
587 | _arguments -s -w : $_hg_global_opts \ |
|
588 | _arguments -s -w : $_hg_global_opts \ | |
588 | '(--all -a :)'{-a,--all}'[pop all patches]' \ |
|
589 | '(--all -a :)'{-a,--all}'[pop all patches]' \ | |
589 | '(--name -n)'{-n+,--name}'[queue name to pop]:' \ |
|
590 | '(--name -n)'{-n+,--name}'[queue name to pop]:' \ | |
590 | '(--force -f)'{-f,--force}'[forget any local changes]' \ |
|
591 | '(--force -f)'{-f,--force}'[forget any local changes]' \ | |
591 | ':patch:_hg_qapplied' |
|
592 | ':patch:_hg_qapplied' | |
592 | } |
|
593 | } | |
593 |
|
594 | |||
594 | _hg_cmd_qprev() { |
|
595 | _hg_cmd_qprev() { | |
595 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
596 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
596 | } |
|
597 | } | |
597 |
|
598 | |||
598 | _hg_cmd_qpush() { |
|
599 | _hg_cmd_qpush() { | |
599 | _arguments -s -w : $_hg_global_opts \ |
|
600 | _arguments -s -w : $_hg_global_opts \ | |
600 | '(--all -a :)'{-a,--all}'[apply all patches]' \ |
|
601 | '(--all -a :)'{-a,--all}'[apply all patches]' \ | |
601 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ |
|
602 | '(--list -l)'{-l,--list}'[list patch name in commit text]' \ | |
602 | '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ |
|
603 | '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ | |
603 | '(--name -n)'{-n+,--name}'[merge queue name]:' \ |
|
604 | '(--name -n)'{-n+,--name}'[merge queue name]:' \ | |
604 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ |
|
605 | '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ | |
605 | ':patch:_hg_qunapplied' |
|
606 | ':patch:_hg_qunapplied' | |
606 | } |
|
607 | } | |
607 |
|
608 | |||
608 | _hg_cmd_qrefresh() { |
|
609 | _hg_cmd_qrefresh() { | |
609 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ |
|
610 | _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ | |
610 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ |
|
611 | '(--git -g)'{-g,--git}'[use git extended diff format]' \ | |
611 | '(--short -s)'{-s,--short}'[short refresh]' \ |
|
612 | '(--short -s)'{-s,--short}'[short refresh]' \ | |
612 | '*:files:_files -W $(_hg_cmd root)' |
|
613 | '*:files:_files -W $(_hg_cmd root)' | |
613 | } |
|
614 | } | |
614 |
|
615 | |||
615 | _hg_cmd_qrename() { |
|
616 | _hg_cmd_qrename() { | |
616 | _arguments -s -w : $_hg_global_opts \ |
|
617 | _arguments -s -w : $_hg_global_opts \ | |
617 | ':patch:_hg_qseries' \ |
|
618 | ':patch:_hg_qseries' \ | |
618 | ':destination:' |
|
619 | ':destination:' | |
619 | } |
|
620 | } | |
620 |
|
621 | |||
621 | _hg_cmd_qselect() { |
|
622 | _hg_cmd_qselect() { | |
622 | _arguments -s -w : $_hg_global_opts \ |
|
623 | _arguments -s -w : $_hg_global_opts \ | |
623 | '(--none -n :)'{-n,--none}'[disable all guards]' \ |
|
624 | '(--none -n :)'{-n,--none}'[disable all guards]' \ | |
624 | '(--series -s :)'{-s,--series}'[list all guards in series file]' \ |
|
625 | '(--series -s :)'{-s,--series}'[list all guards in series file]' \ | |
625 | '--pop[pop to before first guarded applied patch]' \ |
|
626 | '--pop[pop to before first guarded applied patch]' \ | |
626 | '--reapply[pop and reapply patches]' \ |
|
627 | '--reapply[pop and reapply patches]' \ | |
627 | '*:guards:_hg_qguards' |
|
628 | '*:guards:_hg_qguards' | |
628 | } |
|
629 | } | |
629 |
|
630 | |||
630 | _hg_cmd_qseries() { |
|
631 | _hg_cmd_qseries() { | |
631 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \ |
|
632 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \ | |
632 | '(--missing -m)'{-m,--missing}'[print patches not in series]' |
|
633 | '(--missing -m)'{-m,--missing}'[print patches not in series]' | |
633 | } |
|
634 | } | |
634 |
|
635 | |||
635 | _hg_cmd_qunapplied() { |
|
636 | _hg_cmd_qunapplied() { | |
636 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
637 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
637 | } |
|
638 | } | |
638 |
|
639 | |||
639 | _hg_cmd_qtop() { |
|
640 | _hg_cmd_qtop() { | |
640 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts |
|
641 | _arguments -s -w : $_hg_global_opts $_hg_qseries_opts | |
641 | } |
|
642 | } | |
642 |
|
643 | |||
643 | _hg_cmd_strip() { |
|
644 | _hg_cmd_strip() { | |
644 | _arguments -s -w : $_hg_global_opts \ |
|
645 | _arguments -s -w : $_hg_global_opts \ | |
645 | '(--force -f)'{-f,--force}'[force multi-head removal]' \ |
|
646 | '(--force -f)'{-f,--force}'[force multi-head removal]' \ | |
646 | '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ |
|
647 | '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ | |
647 | '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ |
|
648 | '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ | |
648 | ':revision:_hg_tags' |
|
649 | ':revision:_hg_tags' | |
649 | } |
|
650 | } | |
650 |
|
651 | |||
651 | _hg "$@" |
|
652 | _hg "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now