Lojic Technologies

Use vimdiff to display subversion diffs

with 3 comments

I prefer using vimdiff or gvimdiff to view differences between files. When researching ways to allow using vimdiff to view subversion differences, I came across this article.

The bottom line is that subversion passes the two relevant arguments as the 6th and 7th arguments, so the following shell script wrapper does the trick:

#!/bin/sh
/usr/bin/gvimdiff ${6} ${7}

Save the script as gvimdiff_wrapper.sh, make it executable and accessible on your path. Then modify $HOME/.subversion/config to have the following line:

diff-cmd = gvimdiff_wrapper.sh

That will allow you to use gvimdiff to display the diff generated by svn diff my_file.txt

Written by Brian Adkins

November 27, 2007 at 10:14 am

Posted in programming

Tagged with , , ,

3 Responses

Subscribe to comments with RSS.

  1. Great tip! Thanks.

    This works perfectly when doing a straight svn diff like this:
    svn diff file1.php

    But when I want to compare two arbitrary revisions in the svn repository like this:
    svn diff -r 65:24 file1.php

    it doesn’t work. gvimdiff opens with two empty files named tmp and tmp.2

    Any idea on how to make it work in this situation?

    Dean

    October 23, 2008 at 2:44 pm

  2. Sorry, I don’t have a good solution off hand. I actually switched to Emacs a while ago and it handles anything I’ve thrown at it.

    Brian Adkins

    October 31, 2008 at 2:30 pm

  3. gvimdiff –nofork might help there Dean

    dig

    January 8, 2009 at 10:51 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: