New merge tool system in mainline

Matt Mackall mpm at selenic.com
Sun Feb 3 20:04:57 CST 2008


I've introduced a powerful new merge tool scheme to mainline, heavily
inspired by Steve and Arve's work for TortoiseHG (thanks, guys!). The
basic idea is to make setting up a merge tool as simple as possible.

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

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list