[PATCH 6 of 6] filemerge: show actual capabilities of internal merge tools

Yuya Nishihara yuya at tcha.org
Thu Aug 16 06:13:40 EDT 2018


On Thu, 16 Aug 2018 03:35:38 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1534252828 -32400
> #      Tue Aug 14 22:20:28 2018 +0900
> # Node ID f65c2eed9d606cbe7c5c76a8787f2db710abc445
> # Parent  813cc2cf9c0cae1928584518afb4558c443b77b7
> # Available At https://bitbucket.org/foozy/mercurial-wip
> #              hg pull https://bitbucket.org/foozy/mercurial-wip -r f65c2eed9d60
> # EXP-Topic filemerge-refactor
> filemerge: show actual capabilities of internal merge tools
> 
> This information is useful to know which internal merge tools can be
> applied safely on binary files and/or symlinks.
> 
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -989,6 +989,12 @@ def loadinternalmerge(ui, extname, regis
>          internals['internal:' + name] = func
>          internalsdoc[fullname] = func
>  
> +        capabilities = sorted([k for k, v in func.capabilities.items() if v])
> +        if capabilities:
> +            capdesc = _("(actual capabilities: %s)") % ', '.join(capabilities)
> +            func.__doc__ = (func.__doc__ +
> +                            pycompat.sysstr("\n\n    %s" % capdesc))

I suspect this would crash if "(actual capabilities: %s)" were translated
because func.__doc__ is fed to gettext().

Since you are the expert, I leave it to you.


More information about the Mercurial-devel mailing list