Saturday, May 13, 2006

subversion diff wrapper

I am working on some projects that use subversion as their source control tool.  I don't mind the command line tool to check things in and out, but I don't like using diff as my coparison tool.  Subversion does allow an external diff tool to be used, but the way that the tool is called is not like the standard "command <file1> <file2>

So I created a wrapper script, based upon this script, that will allow you to use any diff program when you do "svn diff"

#!/usr/bin/env bash
# if the SVN_DIFF environment variable is not set, fall back to the diff
# program specified here
# remove tmp-file and leave program
# look for diff program
# first try $SVN_DIFF
if [ ! -z $SVN_DIFF ]
DIFF=`which $SVN_DIFF 2> /dev/null || echo unknown`
# if we found the prog, everything's fine
# otherwise look for prog specified above...
if [ $DIFF == "unknown" ]
DIFF=`which $DIFF_PROG 2> /dev/null || echo unknown`
if [ ! ${SEARCHED}x = x ]; then SEARCHED="$SEARCHED or "; fi
# if we still coudn't find a diff, exit
if [ $DIFF == "unknown" ]
echo "Couldn't find $SEARCHED, is it installed and in \$PATH?"
cleanup 2
echo "using diff: $DIFF"
$DIFF $6 $7

On my mac, I am now using twdiff, which is the command line diff program that comes with TextWrangler

Technorati Tags:

No comments:

Post a Comment

Revolutionizing Air Quality Monitoring: How I Upgraded Our System with Mila Integration for Smart Home Automation

In this blog post , I explained how I set up an air quality monitoring system for our neighborhood. With this setup, we can keep an eye on t...