[PATCH 0 of 5] Interactive editor merge with markers

David Champion dgc at uchicago.edu
Mon May 10 11:48:17 CDT 2010


[take 2, incorporating feedback from Matt Mackall and Isaac Jurado]

The [merge-tools] framework is very nice, but there is a case that
hgmerge supported that this does not.  Without hgmerge, if no merge
tools are available, the merge-tools framework pushes a user into rounds
of 'hg resolve -l' to find unresolved files, followed by manually
invoking the editor and using 'hg merge -m' to mark them resolved.
Hgmerge by contrast will place merge markers into a file to be merged
and invoke the editor automatically, then (crucially) ask the user
whether merge succeeded.  But hgmerge is otherwise obsolete, it is no
longer distributed, and it depends on RCS's merge program to do the
dirty work even though Mercurial has the same functionality internally.

If you consider the editor to be the merge tool, this is a case where
merge cannot launch your merge tool for you in a useful way.

This patch series:
1. changes tool.premerge to accept a boolean (as now) or the word 'keep'
   to keep merge markers in the $local file;
2. adds the tool.check option, incorporating tool.checkconflicts and
   tool.checkchanged functions (tool.check = conflicts, changed)
3. adds tool.check = prompt to prompt the user for merge success


[merge-tools]
# If premerge = keep, the merge markers from premerge (simplemerge) are
# left in $local so that the tool can use them as a guide.
tool.premerge = keep

# If tool.check includes 'prompt', the ui will always ask whether the
# merge succeeded, regardless of the merge tool's exit status.
# tool.check is prompt, tool.check = changed will have no effect.
# (The user will not be prompted twice.)
#tool.check = changed, conflicts
tool.check = always

We also change the priority of the worst-case merge tool in
contrib/mergetools.hgrc from -10 (which is used elsewhere in the file)
to -100 (since it's really the last tool you would want), and add a new
'editor' merge tool to contrib/mergetools.hgrc that uses the new flags.

All these changes together make the [merge-tools] fully as featureful as
the hgmerge script was.


More information about the Mercurial-devel mailing list