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

Yuya Nishihara yuya at tcha.org
Wed May 2 05:01:45 EDT 2018


On Tue, 1 May 2018 14:06:12 -0600, Tom Hindle wrote:
> So this would just involve the addition of the ":callable" where one 
> would specify a function name?

Yes. I think that's a good practice to confine side-effects to be made
by a merge script.

> 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.

Running myTool.py in hg process wouldn't be that simple. myTool.py has to
be rewritten to use ui.write() instead of print(), myTool.py might crash
because of re-initializing GUI context, etc. If we support in-process merge
scripts, I think they should be considered hg extensions.


More information about the Mercurial-devel mailing list