Show More
@@ -54,16 +54,21 b'' | |||||
54 |
|
54 | |||
55 | shopt -s extglob |
|
55 | shopt -s extglob | |
56 |
|
56 | |||
|
57 | _hg_cmd() | |||
|
58 | { | |||
|
59 | HGPLAIN=1 "$hg" "$@" 2>/dev/null | |||
|
60 | } | |||
|
61 | ||||
57 | _hg_commands() |
|
62 | _hg_commands() | |
58 | { |
|
63 | { | |
59 | local commands |
|
64 | local commands | |
60 |
commands="$( |
|
65 | commands="$(_hg_cmd debugcomplete "$cur")" || commands="" | |
61 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) |
|
66 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) | |
62 | } |
|
67 | } | |
63 |
|
68 | |||
64 | _hg_paths() |
|
69 | _hg_paths() | |
65 | { |
|
70 | { | |
66 |
local paths="$( |
|
71 | local paths="$(_hg_cmd paths | sed -e 's/ = .*$//')" | |
67 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur")) |
|
72 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur")) | |
68 | } |
|
73 | } | |
69 |
|
74 | |||
@@ -77,21 +82,21 b' shopt -s extglob' | |||||
77 |
|
82 | |||
78 | _hg_status() |
|
83 | _hg_status() | |
79 | { |
|
84 | { | |
80 |
local files="$( |
|
85 | local files="$(_hg_cmd status -n$1 .)" | |
81 | local IFS=$'\n' |
|
86 | local IFS=$'\n' | |
82 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) |
|
87 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) | |
83 | } |
|
88 | } | |
84 |
|
89 | |||
85 | _hg_tags() |
|
90 | _hg_tags() | |
86 | { |
|
91 | { | |
87 |
local tags="$( |
|
92 | local tags="$(_hg_cmd tags -q)" | |
88 | local IFS=$'\n' |
|
93 | local IFS=$'\n' | |
89 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur")) |
|
94 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur")) | |
90 | } |
|
95 | } | |
91 |
|
96 | |||
92 | _hg_branches() |
|
97 | _hg_branches() | |
93 | { |
|
98 | { | |
94 |
local branches="$( |
|
99 | local branches="$(_hg_cmd branches -q)" | |
95 | local IFS=$'\n' |
|
100 | local IFS=$'\n' | |
96 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) |
|
101 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) | |
97 | } |
|
102 | } | |
@@ -144,7 +149,7 b' shopt -s extglob' | |||||
144 | return |
|
149 | return | |
145 | fi |
|
150 | fi | |
146 |
|
151 | |||
147 |
opts=$( |
|
152 | opts=$(_hg_cmd debugcomplete --options "$cmd") | |
148 |
|
153 | |||
149 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")) |
|
154 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")) | |
150 | return |
|
155 | return | |
@@ -175,7 +180,7 b' shopt -s extglob' | |||||
175 | fi |
|
180 | fi | |
176 |
|
181 | |||
177 | # canonicalize the command name and try again |
|
182 | # canonicalize the command name and try again | |
178 |
help=$( |
|
183 | help=$(_hg_cmd help "$cmd") | |
179 | if [ $? -ne 0 ]; then |
|
184 | if [ $? -ne 0 ]; then | |
180 | # Probably either the command doesn't exist or it's ambiguous |
|
185 | # Probably either the command doesn't exist or it's ambiguous | |
181 | return |
|
186 | return | |
@@ -272,7 +277,7 b' shopt -s extglob' | |||||
272 | return 0 |
|
277 | return 0 | |
273 | } |
|
278 | } | |
274 |
|
279 | |||
275 |
complete -o bashdefault -o default -F _hg hg |
|
280 | complete -o bashdefault -o default -F _hg hg \ | |
276 | || complete -o default -F _hg hg |
|
281 | || complete -o default -F _hg hg | |
277 |
|
282 | |||
278 |
|
283 | |||
@@ -281,7 +286,7 b' complete -o bashdefault -o default -F _h' | |||||
281 | # bookmarks |
|
286 | # bookmarks | |
282 | _hg_bookmarks() |
|
287 | _hg_bookmarks() | |
283 | { |
|
288 | { | |
284 |
local bookmarks="$( |
|
289 | local bookmarks="$(_hg_cmd bookmarks --quiet )" | |
285 | local IFS=$'\n' |
|
290 | local IFS=$'\n' | |
286 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur")) |
|
291 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur")) | |
287 | } |
|
292 | } | |
@@ -298,7 +303,7 b' complete -o bashdefault -o default -F _h' | |||||
298 | _hg_ext_mq_patchlist() |
|
303 | _hg_ext_mq_patchlist() | |
299 | { |
|
304 | { | |
300 | local patches |
|
305 | local patches | |
301 |
patches=$( |
|
306 | patches=$(_hg_cmd $1) | |
302 | if [ $? -eq 0 ] && [ "$patches" ]; then |
|
307 | if [ $? -eq 0 ] && [ "$patches" ]; then | |
303 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")) |
|
308 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")) | |
304 | return 0 |
|
309 | return 0 | |
@@ -308,7 +313,7 b' complete -o bashdefault -o default -F _h' | |||||
308 |
|
313 | |||
309 | _hg_ext_mq_queues() |
|
314 | _hg_ext_mq_queues() | |
310 | { |
|
315 | { | |
311 |
local root=$( |
|
316 | local root=$(_hg_cmd root) | |
312 | local n |
|
317 | local n | |
313 | for n in $(cd "$root"/.hg && compgen -d -- "$cur"); do |
|
318 | for n in $(cd "$root"/.hg && compgen -d -- "$cur"); do | |
314 | # I think we're usually not interested in the regular "patches" queue |
|
319 | # I think we're usually not interested in the regular "patches" queue | |
@@ -379,10 +384,9 b' complete -o bashdefault -o default -F _h' | |||||
379 |
|
384 | |||
380 | _hg_cmd_qcommit() |
|
385 | _hg_cmd_qcommit() | |
381 | { |
|
386 | { | |
382 |
local root=$( |
|
387 | local root=$(_hg_cmd root) | |
383 | # this is run in a sub-shell, so we can't use _hg_status |
|
388 | # this is run in a sub-shell, so we can't use _hg_status | |
384 |
local files=$(cd "$root/.hg/patches" |
|
389 | local files=$(cd "$root/.hg/patches" && _hg_cmd status -nmar) | |
385 | "$hg" status -nmar 2>/dev/null) |
|
|||
386 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) |
|
390 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) | |
387 | } |
|
391 | } | |
388 |
|
392 | |||
@@ -412,7 +416,7 b' complete -o bashdefault -o default -F _h' | |||||
412 |
|
416 | |||
413 | _hg_ext_mq_guards() |
|
417 | _hg_ext_mq_guards() | |
414 | { |
|
418 | { | |
415 |
|
|
419 | _hg_cmd qselect --series | sed -e 's/^.//' | |
416 | } |
|
420 | } | |
417 |
|
421 | |||
418 | _hg_cmd_qselect() |
|
422 | _hg_cmd_qselect() | |
@@ -557,7 +561,7 b' complete -o bashdefault -o default -F _h' | |||||
557 | # shelve |
|
561 | # shelve | |
558 | _hg_shelves() |
|
562 | _hg_shelves() | |
559 | { |
|
563 | { | |
560 |
local shelves="$( |
|
564 | local shelves="$(_hg_cmd unshelve -l .)" | |
561 | local IFS=$'\n' |
|
565 | local IFS=$'\n' | |
562 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) |
|
566 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) | |
563 | } |
|
567 | } |
@@ -377,8 +377,7 b' typeset -A _hg_cmd_globals' | |||||
377 | '--remotecmd[specify hg command to run on the remote side]:') |
|
377 | '--remotecmd[specify hg command to run on the remote side]:') | |
378 |
|
378 | |||
379 | _hg_cmd() { |
|
379 | _hg_cmd() { | |
380 | _call_program hg hg --config ui.verbose=0 --config defaults."$1"= \ |
|
380 | _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null | |
381 | "$_hg_cmd_globals[@]" "$@" 2> /dev/null |
|
|||
382 | } |
|
381 | } | |
383 |
|
382 | |||
384 | _hg_cmd_add() { |
|
383 | _hg_cmd_add() { |
General Comments 0
You need to be logged in to leave comments.
Login now