Using external diff tools with PIDA

You can use external GUI diff tools with PIDA, such as meld or gvimdiff by creating a wrapper shell script for the tool you want, such as:

#!/bin/sh

# Configure your favorite diff program here.
DIFF="/usr/bin/meld"

# Subversion provides the paths we need as the sixth and seventh 
# parameters.
LEFT=${6}
RIGHT=${7}

# Call the diff command (change the following line to make sense for
# your merge program).
$DIFF $LEFT $RIGHT

# Return an errorcode of 0 if no differences were detected, 1 if some were.
# Any other errorcode will be treated as fatal.

Save that somewhere like ~/bin/diffwrap.sh, and make it executable.

Next, edit ~/.subversion/config and add the following in the [helpers] section:

diff-cmd = /home/you/bin/diffwrap.sh

Now when you do a diff with PIDA's 'Differences' command, it will launch the external tool :)

This works for GUI diff tools such as meld and gvimdiff - it does not work for console tools such as plain vimdiff, although it might if your wrapper script launches vimdiff in a new terminal window.

A side effect of this approach is that if you diff a directory, it will launch the external diff tool sequentially - ie, diff the first file, close the file, diff the next file, close the file, etc. In practice, it's actually kind of nice, as it gives you a chance to review each file's changes, separate from the other files' changes, instead of sifting through the normal unified diff.

Also, by changing your ~/.subversion/config, this is setting the diff tool used globally by subversion - if you don't want that, then don't do this!

Credits: Matt Wilson, SVN book