From: Anton Shestakov <av6@dwimlabs.net>
To: zsh-workers@zsh.org
Cc: Anton Shestakov <av6@dwimlabs.net>
Subject: [PATCH 2/2] _hg: suggest merge tools for -t/--tool
Date: Wed, 22 Aug 2018 22:40:00 +0800 [thread overview]
Message-ID: <20180822144000.4736-2-av6@dwimlabs.net> (raw)
In-Reply-To: <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
prev parent reply other threads:[~2018-08-22 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-22 14:39 [PATCH 1/2] _hg: add completion of -S/--subrepos to many commands Anton Shestakov
2018-08-22 14:40 ` Anton Shestakov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180822144000.4736-2-av6@dwimlabs.net \
--to=av6@dwimlabs.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).