You are here: News
Akatombo Media logo
English 日本語

Akatombo Web Log

Thursday, April 27, 2006

Ignore whitespace in a Subversion diff

Doing some work on a software project, in which part of the modifications I’m doing involve changing the indents on the code to make it conform to the coding conventions I follow and make it easier to easily read the code at a glance.  When I have finished doing that though, I want to go back and make sure I haven’t inadvertently screwed something up in the actual code while I was changing the spacing.

svn diff doesn’t have a built in option for ignoring whitespace, but gnu diff does, so we use that.

to use a different diff command us the --diff-cmd parameter to svn diff, and to pass options to that command use the -x parameter.

If I was going to run the command in gnu diff directly I would use diff -uw /path/to/file1 /path/to/file2

In svn I want to diff against the latest version in the working copy (BASE) so I only need to pass in the file to diff and no revision info

Here is the command:

svn diff --diff-cmd diff -x -uw /path/to/file

Now at some point I have to see if I can figure out how to hack the subversion bundle for textmate to make that option available to me in the nice html highlighted view.

Posted by UltraBob on 04/27 at 10:29 AM
8 Comments | No Trackbacks | Permanent Link


Page 1 of 1 pages