Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view svn diff in vimdiff style in svn

Tags:

linux

vim

unix

svn

I am starting to use Subversion on Linux. svn diff gives a very cryptic view—very, very unfriendly to eyes. How do I interpret its output? And more importantly, is there a way to view the difference in vimdiff kind of neat style, where both files will open side by side?

like image 394
xyz Avatar asked Oct 23 '11 13:10

xyz


1 Answers

Edit the file $HOME/.subversion/config so it contains the line:

diff-cmd = <your favorite diff application>

Some diff apps support svn. For example, diff-cmd = meld should work fine. However, vimdiff is not one of them. The reason for that is that svn diff gives the files to be compared as 6th and 7th arguments, and not as 1st and 2nd as usual. So what most people do in this situation is this:

Create a wrapper script:

#!/bin/sh

/usr/bin/vimdiff ${6} ${7}

Save it, for example, at $HOME/bin/svndiffwrap.sh

Do not forget to make it executable chmod +x $HOME/bin/svndiffwrap.sh.

Make it the svn diff command:

in $HOME/.subversion/config:

diff-cmd = /home/<username>/bin/svndiffwrap.sh

Note: Some svn clients do not support paths that uses $HOME environment variable. So it is useful to specify full path.

like image 125
Omer Dagan Avatar answered Sep 29 '22 12:09

Omer Dagan