Kevin Trowbridge

Software Developer. Husband. I ❤ Webpages.

Integrating Mercurial With the OSX Opendiff Tool

| Comments

The command line diff tool produces textual diffs. These are not useful for visualizing complicated changes. However, the Apple Developer Toolset includes a pretty good graphical diff tool called FileMerge. You can pop open FileMerge from the command line with the command opendiff.

The use of opendiff is fairly simple … just type opendiff file1 file2 at the OSX command line, and a graphical diff window pops open.

But when we are working with version control tools, and we want to view which changes we have made to a file … a diff is generated by the version control software itself … so there aren’t two files to easily diff …

However, you can integrate opendiff into mercurial, so that when you type hg diff, you see a diff pop up in opendiff.

I got this information from the mercurial wiki

I got this working with the following procedure:

  1. cd ~/Desktop
  2. svn co
  3. cd fmscripts
  4. sudo make install
  5. mate ~/.hgrc
  6. Paste the configuration lines from that mercurial wiki referenced above into the .hgrc file, save, and exit.

Now you can type:

hg opendiff file

And see the results in opendiff:

screenshot of OSX opendiff tool