Change default SVN diffing tool


Following a blog, I created a batch file, wm.bat:

"d:\svnroot\external\winmerge\WinMerge.exe" /B /WAIT "d:\svnroot\external\winmerge\WinMergeU.exe" /e /ub /dl %3 /dr %5 %6 %7

And I tried calling

svn diff | wm

but that didn't work. So how do I integrate WinMerge or similar utility with svn diff?

Extending on David's answer below, changing the default for Windows requires editing the configuration file located at (for Windows XP)

C:\Documents and Settings\%USERNAME%\Application Data\Subversion\config

or (Windows Vista)


Best Solution

Ok, looking at the original blog post, this is what you want:

svn diff --diff-cmd wm [optional-filename]

If you want to see what is actually happening here (i.e. what sort of parameters the svn diff passes to the nominated diff-cmd), you can just use svn diff --diff-cmd echo and see what it says:

[~/src/gosmore-dev]$ svn diff --diff-cmd echo
Index: gosmore.cpp
-u -L gosmore.cpp   (revision 13753) -L gosmore.cpp (working copy) .svn/text-base/gosmore.cpp.svn-base gosmore.cpp

Some quotes were removed above, but basically you can see that svn diff will pass

-u -L "<left-label>" -L "<right-label>" <left-file> <right-file> 

to your batch file. The batch file you have is used to turn these commands into the format that WinMerge understands.

More details and examples on how this all works are provided in the svn book.

To make your batch file the default for svn diff, you need to add the following line in the [helpers] section in your local subversion config file (~/.subversion/config in Linux, I'm not sure where the config file is located in Windows) (see this earlier SO question)