Lightweight SVN diff wrapper opendiff

June 03, 2010

I have been using SVN a bit recently (euch after the power of git) and have been doing some merges using
FileMerge (opendiff) a utility which comes with the mac developer tools.

To make this play with SVN 1.5 or greater you have to use a wrapper to call the tool. There is an existing toolset written in shell script but they do not seem to work for me (1.6.9).

  #!/usr/bin/env ruby

  # A ruby wrapper

  unless ARGV.length == 5
    puts "Incorrect number of arguments"
    exit
  end

  left = ARGV[3]
  right = ARGV[4]

  `opendiff #{left} #{right} -merge #{right}`
  exit(0)

Slap this script somewhere and make it executable. Edit your .bash_profile to include the following:

  export SVN_MERGE='/path/to/svn_diff_wrapper.rb'

So when you get presented with the merge options press l and it should load filemerge for merging power.