In February 2008, [:mpm:Matt Mackall] contributed a new [:Merge:merge] tool configuration feature. This feature is available in version 1.0 (see [:WhatsNew]).


To describe a new merge tool, do something like the following in [:.hgrc]:

 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)


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:

**.jpg = myimgmerge
**.exe = internal:fail


See also


1. Choosing internal merge with conflict markers

To have the internal merge with the conflict markers for example in [:TortoiseHg] set

merge = internal:merge

in Mercurial.ini.