>From what I see, this script will supply a diff of the local file against a
revision relative to the local revision. Is this correct? I think the script
comments can be much clearer about what the script does.
Assuming the above is correct. It's obvious what the script should do given a
negative number. What'll it do if given a positive number and branches exist?
Noel
[EMAIL PROTECTED] on 05/25/2000 03:16:05 AM
To: [EMAIL PROTECTED]
cc: (bcc: Noel L Yap)
Subject: Donation: Shell script to compare backwards relative
#!/bin/sh
#
# Do a cvs diff backwards-relative to the current revisions.
#
# Feel free to modify, but please mail mods to
# [EMAIL PROTECTED]
#
# Author: Luke Kendall
#
MYNAME=`basename $0`
USAGE="$MYNAME [delta] CVS-files
where delta is an expression like -1 (the previous revision), -2 (the
revision before the previous one), etc."
if expr "x$1" : "x-[1-9]" > /dev/null
then
delta=`echo "x$1" | sed 's/x-/- /'`
shift
else
delta="- 1"
echo "$MYNAME: No delta provided: -1 assumed." >&2
fi
[ $# = 0 ] && echo "usage: $USAGE" >&2 && exit 1
WH="[ ][ ]*"
cvs stat $@ | grep Repository | \
sed "s/^${WH}Repository
revision:${WH}\([0-9.]*\)\.\([0-9]*\)${WH}.*\/\(.*\),v
*\$/\1 \2 \3/" |
while read majver minver file
do
newmin=`expr $minver $delta`
if [ $newmin -le 0 ]
then
echo "Can't work out previous version of $majver.$minver for $file"
continue
fi
cvs diff -r$majver.$newmin -r $majver.$minver "$file"
done
I've called it cvsbkdiff.
You'd say, e.g. cvs diff -2 *.c
It works under Unix and under UWin.
#!/bin/sh
#
# Do a cvs diff backwards-relative to the current revisions.
#
# Author: Luke Kendall
#
MYNAME=`basename $0`
USAGE="$MYNAME [delta] CVS-files
where delta is an expression like -1 (the previous revision), -2 (the
revision before the previous one), etc."
if expr "x$1" : "x-[1-9]" > /dev/null
then
delta=`echo "x$1" | sed 's/x-/- /'`
shift
else
delta="- 1"
echo "$MYNAME: No delta provided: -1 assumed." >&2
fi
[ $# = 0 ] && echo "usage: $USAGE" >&2 && exit 1
WH="[ ][ ]*"
cvs stat $@ | grep Repository | \
sed "s/^${WH}Repository
revision:${WH}\([0-9.]*\)\.\([0-9]*\)${WH}.*\/\(.*\),v
*\$/\1 \2 \3/" |
while read majver minver file
do
newmin=`expr $minver $delta`
if [ $newmin -le 0 ]
then
echo "Can't work out previous version of $majver.$minver for $file"
continue
fi
cvs diff -r$majver.$newmin -r $majver.$minver "$file"
done
This communication is for informational purposes only. It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan & Co. Incorporated, its
subsidiaries and affiliates.