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