Fixed the -r flag processing.
Added support for files in directories (Francesc) Added a trap to make sure the temp file is removed regardless of how the script exits (Balbir Singh, http://www.dbacorner.com/)
This commit is contained in:
parent
c6bd983409
commit
dc58603161
1 changed files with 17 additions and 9 deletions
22
svndiff.sh
22
svndiff.sh
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# svndiff -- svn diff with vimdiff.
|
# svndiff -- svn diff with vimdiff.
|
||||||
|
# http://erik.thauvin.net/blog/posts/1024/subversion-diff-with-vim
|
||||||
#
|
#
|
||||||
# Written by Erik C. Thauvin (erik@thauvin.net)
|
# Written by Erik C. Thauvin (erik@thauvin.net)
|
||||||
# May 11, 2006
|
# May 11, 2006
|
||||||
#
|
#
|
||||||
# Copyright (C) 2006 Erik C. Thauvin. All rights reserved.
|
# Copyright (C) 2006-2011 Erik C. Thauvin. All rights reserved.
|
||||||
#
|
#
|
||||||
# This software is provided "as is" without express or implied warranties.
|
# This software is provided "as is" without express or implied warranties.
|
||||||
#
|
#
|
||||||
|
@ -15,26 +16,33 @@
|
||||||
# with other software which is sold or distributed for profit, without the
|
# with other software which is sold or distributed for profit, without the
|
||||||
# permission of the author.
|
# permission of the author.
|
||||||
#
|
#
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# Modified by felix021 (felix021@gmail.com)
|
# Modified by felix021 (felix021@gmail.com)
|
||||||
# Aug 3, 2010
|
# Aug 3, 2010
|
||||||
|
#
|
||||||
|
# Fixed the -r flag processing.
|
||||||
|
# Added support for files in directories (Francesc)
|
||||||
|
# Added a trap to make sure the temp file is removed regardless of how the
|
||||||
|
# script exits (Balbir Singh, http://www.dbacorner.com/)
|
||||||
|
# Jan 18, 2011
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
|
||||||
PROGNAME=`basename $0`
|
PROGNAME=`basename $0`
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: $PROGNAME <file>"
|
echo "Usage: $PROGNAME <file> [-r rev]"
|
||||||
exit;
|
exit;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
filename=$1
|
filename=$1
|
||||||
pid=$$
|
pid=$$
|
||||||
TEMP=/tmp/tmp.$pid.$filename
|
TEMP=/tmp/tmp.$pid.`basename $filename`
|
||||||
pv=
|
pv=
|
||||||
|
|
||||||
if [ $# -gt 3 -a $2 = "-r" ]; then
|
trap 'rm -f $TEMP' 0 1 2 15
|
||||||
|
|
||||||
|
if [ $# -eq 3 -a $2 = "-r" ]; then
|
||||||
pv="-r $3"
|
pv="-r $3"
|
||||||
fi
|
fi
|
||||||
svn cat $filename $pv > $TEMP
|
svn cat $filename $pv > $TEMP
|
||||||
vimdiff $TEMP $filename
|
vimdiff $TEMP $filename
|
||||||
rm -f $TEMP
|
|
Loading…
Add table
Add a link
Reference in a new issue