Configuring Mercurial - FileMerge for Apple Mac OS X

Frank V picture Frank V · Aug 20, 2009 · Viewed 11.5k times · Source

How do I configure Apple's FileMerge program to function as Mercurial's merge tool? I have my .hgrc file setup in my home directory and I simply want to configure FileMerge as the merge program.

Answer

Ned Deily picture Ned Deily · Aug 20, 2009

As described in the hg wiki, this has worked for me with various versions of hg:

  • Create a script somewhere in your $PATH, say in /usr/local/bin:
$ vim /usr/local/bin/opendiff-w

#!/bin/sh
# opendiff returns immediately, without waiting for FileMerge to exit.
# Piping the output makes opendiff wait for FileMerge.
opendiff "$@" | cat
  • Add the following sections to your ~/.hgrc:
[extdiff]
cmd.interdiff = hg-interdiff
cmd.opendiff = opendiff-w

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

[extensions]
extdiff = 

Now you can use it as $hg opendiff.