1.4. Mac OS X Specific

Apple’s included FileMerge tool is an extremely powerful 3-way merge tool that you really want to be using for visual diffs and manual merges. It can be launched from the command-line using opendiff, but unfortunately if you call it directly it doesn’t block further execution in the console which causes problems for Mercurial. So, the first thing you need to do is create a wrapper script called "opendiff-w" in /usr/bin (or somewhere else on your path), with this content:

#!/bin/sh
opendiff "$@" | cat

Make sure you chmod +x this file. Then, make the following changes in your ~/.hgrc file:

[extensions]
hgext.extdiff =

[extdiff]
cmd.opendiff = opendiff-w

[merge-tools]
filemerge.executable = opendiff-w
filemerge.args = $local $other -ancestor $base -merge $output

The first entry makes the opendiff command available so you can call hg opendiff instead of hg diff and it will open up FileMerge instead of showing you a unified diff on the command line. The merge-tools section makes opendiff the default when merging.