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