Mercurial > hg
changeset 39123:4d7b11877dd0
filemerge: add the function to examine a capability of a internal tool
For "symlink" and "binary" capabilities, _toolbool() can not examine
these of internal merge tools strictly, because it examines only
configurations in "merge-tools" section.
Users can configure them explicitly as below for example, but this is
not ordinary usage and not convenient:
[merge-tools]
:other.symlink = true
:other.binary = true
This patch adds hascapability() internal function, which can examine
actual capabilities of a internal merge tool strictly.
At this patch, hascapability() is still used with "strict=False".
Subsequent patches use it with "strict=True".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 14 Aug 2018 20:15:51 +0900 |
parents | 5d3b58472660 |
children | 6618634e3325 |
files | mercurial/filemerge.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filemerge.py Tue Aug 14 20:08:27 2018 +0900 +++ b/mercurial/filemerge.py Tue Aug 14 20:15:51 2018 +0900 @@ -137,6 +137,12 @@ return procutil.findexe(util.expandpath(exe)) def _picktool(repo, ui, path, binary, symlink, changedelete): + def hascapability(tool, capability, strict=False): + if strict and tool in internals: + if internals[tool].capabilities.get(capability): + return True + return _toolbool(ui, tool, capability) + def supportscd(tool): return tool in internals and internals[tool].mergetype == nomerge @@ -149,9 +155,9 @@ ui.warn(_("couldn't find merge tool %s\n") % tmsg) else: # configured but non-existing tools are more silent ui.note(_("couldn't find merge tool %s\n") % tmsg) - elif symlink and not _toolbool(ui, tool, "symlink"): + elif symlink and not hascapability(tool, "symlink"): ui.warn(_("tool %s can't handle symlinks\n") % tmsg) - elif binary and not _toolbool(ui, tool, "binary"): + elif binary and not hascapability(tool, "binary"): ui.warn(_("tool %s can't handle binary\n") % tmsg) elif changedelete and not supportscd(tool): # the nomerge tools are the only tools that support change/delete