[PATCH] merge: add resolve --prep, which outputs conflicted comparison files

Jun Wu quark at fb.com
Fri Feb 24 18:25:37 EST 2017


Excerpts from Durham Goode's message of 2017-02-24 15:18:40 -0800:
> On 2/23/17 2:57 PM, Jun Wu wrote:
> > Congratulations on your first patch to the list!
> >
> > But I think we have better ways to achieve the same goal that we may prefer
> > them to this patch.
> >
> > 1) Better way to provide conflicted file contents - in-python merge tools
> >
> >   From a high-level, the patch tries to solve the problem:
> >
> >     - Get all paths and file contents involved in merge conflict resolution
> >       in an efficient way.
> >
> >   We have "--list" and "--tool" already to fetch the data in a less efficient
> >   way. I'm not a big fan of a new flag doing what we can do today.
> >
> >   I think a better to achieve the "efficient" goal is to make "--tool"
> >   accept Python functions, just like what we do for hooks. If the signature
> >   of the Python function accepts file contents directly, we can even avoid
> >   writing temporary files - even more efficient than this patch.
> 
> While that way may be more generic, and potentially more efficient in 
> some cases, it puts a larger burden of understanding on the consumer. 
> They would have to learn about Mercurial internals (or at least the api 
> for the hook), write a python script, and package that script into their 
> deployment.  Given that Mercurial already has knowledge of what data 
> merge tools need, I think it's reasonable to just have an interface that 
> prints that data for simple consumption.

That shouldn't be an issue if we ship the Python merge function that
generates the format they want - what they need is to just put a single line
of config, like "merge-tool=somemod:jsonexport"

> If we want to get rid of the extra flag, we could just make this data 
> appear in the normal json output.  So 'hg resolve --list --all -T json' 
> would contain the same data as 'hg resolve --prep --all -T json'. It 
> changes the behavior of --list a bit, depending on if json is enabled or 
> not, but at least there's no new UI surface area.

With the Python merge tool approach, there won't be an additional flag.


More information about the Mercurial-devel mailing list