In February 2008, Matt Mackall contributed a new merge tool configuration feature. This feature is available in version 1.0 (see WhatsNew).
Details
To describe a new merge tool, do something like the following in .hgrc:
[merge-tools] mymergetool.args=$local $other $base -o $output
If you've got no other merge tools defined, Mercurial will run "mymergetool" with the appropriate arguments. Further tool options include:
<tool>.args - the arguments to pass (defaults to $local $base $other) <tool>.executable - executable name or path (defaults to <tool>) <tool>.binary - supports binary files (False) <tool>.symlinks - supports symlinks (False) <tool>.gui - requires a GUI (False) <tool>.priority - priority of this tool (0) ..etc.
If you have multiple tools defined, Mercurial looks for the highest priority one that will work, falling back to the old hgmerge for backwards compatibility.
If that's not found, we'll use our internal simplemerge code, which is a tool named 'internal:merge'. There are also three other internal tools: local, other, and fail.
To bypass the priority scheme and set the default tool directly, simply set [ui]merge as always.
Merge tool settings suitable for a global configuration file (and roughly equivalent to the ugly old hgmerge script) can be found in contrib/mergetools.hgrc. People building binary packages will want to use this.
To complete the picture, we also now support choosing a merge tool based on file pattern, like so:
[merge-patterns] **.jpg = myimgmerge **.exe = internal:fail
References
"merge: allow smarter tool configuration" in main Mercurial repository (changesets starting with 5af5f0f9d724)
"New merge tool system in mainline", posting by Matt Mackall, Feb 3, 2008, Mercurial mailing list
See also
Notes
Choosing internal merge with conflict markers
To have the internal merge with the conflict markers for example in TortoiseHg set
[ui] merge = internal:merge
in Mercurial.ini.
Overriding merge.ui configuration from the command line
See How to keep "My" or "Their" files when doing merge for an example on how you can override merge configuration on the command line.
