[PATCH 3 of 6] filemerge: add the function to examine a capability of a internal tool

Yuya Nishihara yuya at tcha.org
Thu Aug 16 05:51:55 EDT 2018


On Thu, 16 Aug 2018 03:35:35 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1534245351 -32400
> #      Tue Aug 14 20:15:51 2018 +0900
> # Node ID 1d16378efeb91e435d520b081a7a34b78d7fa7e2
> # Parent  ca968875ed9869cbfa464af05c2a217219f298ed
> # Available At https://bitbucket.org/foozy/mercurial-wip
> #              hg pull https://bitbucket.org/foozy/mercurial-wip -r 1d16378efeb9
> # EXP-Topic filemerge-refactor
> filemerge: add the function to examine a capability of a internal tool

> 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

Is this a documented feature? I suspect it would be a bug.

> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -137,6 +137,12 @@ def findexternaltool(ui, tool):
>      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)

If we want to support "merge-tools:<foo>.binary = false" for example, we'll
have to make _toolbool() tri-state.


More information about the Mercurial-devel mailing list