Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/2] _hg: suggest merge tools for -t/--tool
- X-seq: zsh-workers 43325
- From: Anton Shestakov <av6@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/2] _hg: suggest merge tools for -t/--tool
- Date: Wed, 22 Aug 2018 22:40:00 +0800
- Cc: Anton Shestakov <av6@xxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dwimlabs.net; s=20171204; t=1534948859; bh=xaZguzJWvHJ0L0rU4mVASYjAir8ufF3jSFg5fBDlQrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4V02UKN5gnnvnalhpII0vtOJxpISNjcxb5G2NV9gkrH7zrKuoxDMv15d+1xmLo3e COdYz5D4dq2Bv2Gpn3kRlAtIB27G2fxtns5pte2el8K7Pf5a/MX/gZh7+A+ANkU7Y2 vDVAZGDopd+Y58hq9P6Wcb+i5kIssRhkJQYZXpj0=
- In-reply-to: <20180822144000.4736-1-av6@dwimlabs.net>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180822144000.4736-1-av6@dwimlabs.net>
---
Completion/Unix/Command/_hg | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 99cbd1742..4b88ce4ea 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -282,6 +282,18 @@ _hg_config() {
(( $#items )) && _describe -t config 'config item' items
}
+_hg_internal_merge_tools=(
+ \\:dump \\:fail \\:local \\:merge \\:merge-local \\:merge-other \\:merge3
+ \\:other \\:prompt \\:tagmerge \\:union
+)
+
+_hg_merge_tools() {
+ typeset -a external_tools
+ _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools
+ external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"})
+ (( $#external_tools )) && _describe -t external_tools 'external merge tools' external_tools
+}
+
_hg_addremove() {
_alternative 'files:unknown files:_hg_unknown' \
'files:missing files:_hg_missing'
@@ -387,6 +399,10 @@ _hg_diff_opts=(
'--nodates[omit dates from diff headers]'
)
+_hg_mergetool_opts=(
+ '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool:_hg_merge_tools'
+)
+
_hg_dryrun_opts=(
'(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
@@ -449,7 +465,7 @@ _hg_cmd_archive() {
}
_hg_cmd_backout() {
- _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
+ _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
'--merge[merge with old dirstate parent after backout]' \
'(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
'--parent[parent to choose when backing out merge]' \
@@ -679,7 +695,7 @@ _hg_cmd_manifest() {
}
_hg_cmd_merge() {
- _arguments -s -S : $_hg_global_opts \
+ _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
'(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
'(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \
'(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
@@ -753,7 +769,7 @@ _hg_cmd_resolve() {
local context state state_descr line ret=1
typeset -A opt_args
- _arguments -s -S : $_hg_global_opts \
+ _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
'(--all -a)'{-a,--all}'[select all unresolved files]' \
'(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
'(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
@@ -871,7 +887,7 @@ _hg_cmd_unbundle() {
}
_hg_cmd_update() {
- _arguments -s -S : $_hg_global_opts \
+ _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
'(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \
'(--check -c)'{-c,--check}'[require clean working directory]' \
'(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
--
2.11.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author