subversion and tkdiff

Subversion is my version control of choice, and tkdiff is my graphical diff of choice. I love them both equally.

However, for a while, I thought they couldn’t play well together. I tried svn diff –diff-cmd tkdiff , but it just produced an ugly error message, because svn passed command-line options to tkdiff that it didn’t understand.

I recently sat down to take another look, and found that Subversion support was added to tkdiff in version 4.0. Now, in a Subversion working directory, tkdiff automatically diffs the file against HEAD. Sweet!

I use this simple shell script to tkdiff all files that I’ve modified:

#!/bin/csh
foreach file ( \`svn st -q | cut -c 8-\` )
  tkdiff $file
end

One caveat: by default, tkdiff talks to the master repository (usually over the network) to get HEAD. This is unnecessary, and way slow. BASE is usually just as good, and it’s stored locally, in .svn/text-base. This patch makes tkdiff use the local copy instead.

One thought on “subversion and tkdiff

  1. If one needs to do a diff between two different svn (subversion) revisions of a whole repository then the following can be done:

    svn diff -r37478:37549 | egrep ‘^Index:’ | awk ‘//{print $2}’ | perl -lne ‘system(“tkdiff -r 37478 -r 37549 $_ &”)’

    This assumes that the repository versions that need the difference calculated are revision 37478 and 37549.  Of course a script would be trival to write from here.  (I found the tkdiff –help unhelpful in this respect, so I thought I would share.)

Leave a Reply

Your email address will not be published. Required fields are marked *