[TxMt] FileMerge commands
Aparajita Fishman
aparajita at aparajitaworld.com
Thu Apr 20 18:46:40 UTC 2006
Hi,
I have created a few commands that are analogous to the Subversion
commands which diff against a revision, but instead of generating a
diff output, the result is sent to FileMerge for viewing, which IMHO
is a whole lot easier to read.
The commands look like this:
-------------
require_cmd "${TM_SVN:=svn}" "If you have installed svn, then you
need to either update your <tt>PATH</tt> or set the <tt>TM_SVN</tt>
shell variable (e.g. in Preferences / Advanced)"
require_cmd opendiff "You must install the Apple developer tools to
run FileMerge."
"$TM_BUNDLE_SUPPORT/bin/filemerge.sh" BASE "$TM_FILEPATH"
-------------
filemerge.sh looks like this:
-------------
#!/bin/sh
#
# $1 = svn revision
# $2 = full path to file ($TM_FILEPATH)
# First see if the file is under svn control
FILE=`basename "$2"`
INFO_LINES=`svn info 2>&1 > /dev/null | wc -l`
if [ $INFO_LINES -eq 2 ]; then
echo "The current file is not under subversion control"
exit 206
fi
SIZE=`svn diff -r $1 "$2" | wc -m`
if [ $SIZE -eq 0 ]; then
echo "No difference"
exit 206
fi
INODE=`stat -f "%i" "$2"`
TMPPATH="/tmp/tm-opendiff-$INODE.tmp"
svn cat -r $1 "$2" > "$TMPPATH"
opendiff "$TMPPATH" "$2"
-----------
To create a command for a different revision, change BASE in the
command to something else (e.g. HEAD or PREV).
Regards,
Aparajita
www.aparajitaworld.com
"If you dare to fail, you are bound to succeed."
- Sri Chinmoy | www.srichinmoylibrary.com
More information about the textmate
mailing list