annotate contrib/zsh_completion @ 3539:a6dd7ab568cc

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