streda 25. júna 2014

vimdiff as svn diff tool

It's easy to like vimdiff. It's simply great.

This is small howto for using vimdiff as svn diff tool:

1)
create diffwrap.sh script:
#!/bin/sh
# http://blog.tplus1.com/blog/2007/08/29/how-to-use-vimdiff-as-the-subversion-diff-tool/

# Configure your favorite diff program here.
DIFF="/usr/bin/vimdiff"

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

# Call the diff command (change the following line
# to make sense for your merge program).
#$DIFF --left $LEFT --right $RIGHT
$DIFF $LEFT $RIGHT

# Return an errorcode of 0 if no differences were detected,
# 1 if some were.
# Any other errorcode will be treated as fatal.

2)
create svnvimdiff.sh script:
#!/bin/bash
svn diff --diff-cmd=diffwrap.sh $1 $2 $3 $4 $5 $6 $7 $8

3)
enjoy diffs:
go to svn-versioned folder and run svnvimdiff.sh
It will open vimdiff for every modified file. For diffing only single file just put relative filename (or part of unique path) as parameter.

Žiadne komentáre: