All Articles

Tips of Redirecting the Command "svn diff"

svn-diff

The default output mode of svn diff is verbose. If you have many modifications, it is sometimes difficult to see the differences. Funtunately, svn has provided options for customizing svn diff output.

To change the output of svn diff, we need a script file (such as svndiff.sh) with following content,

#!/bin/sh
DIFF="/usr/bin/vimdiff"

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

# diff command
${DIFF} ${LEFT} ${RIGHT}

Then modify the svn configuration file ~/.subversion/config and make sure the following configuration is written:

[helpers]
diff-cmd = /path/to/svndiff.sh

Then, svn diff will call the svndiff.sh script, which uses vimdiff in svn difference mode.

Published Jun 25, 2013

Flying code monkey