[PATCH] filemerge: support passing python script to custom merge-tools

Tom Hindle tom_hindle at sil.org
Tue May 1 16:06:12 EDT 2018


Hi Yuya,

So this would just involve the addition of the ":callable" where one 
would specify a function name?


One of the reasons I didn't do this, (although I took the hook's 
'python:' part) was because:

If one had something like this:

merge-tools.myTool.executable=c:\\python27\\python.exe
merge-tools.myTool.args=c:\myTool.py $local $base $other

then one could instead just write:

merge-tools.myTool.executable=python:c:\myTool.py

without modifying myTool.py to provide a callable function.


If supporting the :callable part is really required, would making it be 
optional be acceptable?
IE. one could write either:

merge-tools.myTool.executable=python:c:\myTool.py

or

merge-tools.myTool.executable=python:c:\myTool.py:myFunc

and the args would be passed as appropriately.

Thanks
Tom

On 04/19/2018 06:24 AM, Yuya Nishihara wrote:
> On Wed, 18 Apr 2018 07:32:52 -0600, Tom Hindle wrote:
>> # HG changeset patch
>> # User hindlemail <tom_hindle at sil.org>
>> # Date 1523988043 21600
>> #      Tue Apr 17 12:00:43 2018 -0600
>> # Node ID 701f7b1145cb8105428141c22260c89d6b942bef
>> # Parent  62ebfda864de35f306963989303b70235aa63952
>> filemerge: support passing python script to custom merge-tools
>> Eliminates the need to specify a python execuatable, which may not exist on
>> system. Additionally launching script inprocess aids portablity on systems
>> that
>> can't execute python via the shell.
>> example usage "merge-tools.myTool.executable=python:c:\myTool.py"
> Perhaps, we should reuse the in-process hook syntax, which is
>
>    python:modulename.submodule.callable
>    python:/path/to/python/module.py:callable
>



More information about the Mercurial-devel mailing list