Tuesday, June 02, 2009

Getting xxdiff working with svn

I simply love xxdiff as a diff tool to compare source code. Unfortunately there is no easy way to get xxdiff working with svn and hence I wrote a small python based tool implement this svn feature.




#!/usr/bin/env python

import sys
import os

if len(sys.argv) != 2:
print "%s filename" % sys.argv[0]
sys.exit(0)

if not os.path.exists(sys.argv[1]):
print "File %s does not exist" % sys.argv[1]
sys.exit(0)

filename = os.path.split(sys.argv[1])[1]

cmd = "svn cat %s > ~/tmp/%s.old" % (sys.argv[1], filename)
os.system(cmd)

cmd = "xxdiff ~/tmp/%s.old %s" % (filename, sys.argv[1])
os.system(cmd)

0 Comments:

Post a Comment

<< Home