Binary Lion Studios

I code for fun and for food.

Using FileMerge for diffs with Mercurial

Mercurial allows you to setup an external diff tool to handle viewing diffs. Here is how you can get Mercurial to use FileMerge (the merge tool that is installed with the OSX developer tools).

Install the fmscripts wrapper.

Download the scripts, unpack them, and install them.

1
2
3
4
5
$ cd ~/Downloads
$ curl -OL http://www.defraine.net/~brunod/fmdiff/fmscripts-20100225.tar.gz
$ tar xzvf fmscripts-20100225.tar.gz
$ cd fmscripts-20100225
$ sudo make install

Tell Mercurial to use FileMerge

Edit your ~/.hgrc file and add the following:

~/.hgrc
1
2
3
4
5
[extensions]
extdiff=

[extdiff]
cmd.opendiff = fmdiff

Use FileMerge to view a diff

If you have a dirty working copy, you can now view the diff between it and the tip by using the following command:

1
$ hg opendiff

Of course, you can still use all the normal diff options. For example, to view the differences between two revisions, do this:

1
$ hg opendiff -r100 -r101

Or for a single file:

1
$ hg opendiff -r100 -r101 views.py

Or to see the difference between a revision and your working copy for a single file:

1
$ hg opendiff -r101 views.py

Yay, Mercurial.