[m-dev.] for review: add cvdr to tools.

Tyson Dowd trd at cs.mu.OZ.AU
Fri Jan 19 17:37:37 AEDT 2001


Hi,


===================================================================


Estimated hours taken: 0.3

cvdr does revision-by-revision diffs of files under CVS, showing the log
message and revision of each file.

Just what you need when trying to track down what changed recently in
some file.

tools/cvdr:
	Add the cvdr script to the tools directory.


Index: tools/cvdr
===================================================================
RCS file: cvdr
diff -N cvdr
--- /dev/null	Tue Nov 21 11:53:28 2000
+++ cvdr	Fri Jan 19 16:50:39 2001
@@ -0,0 +1,55 @@
+#!/bin/sh
+# cvdr - show the most recent changes to a file stored with CVS
+#
+# Starting from the most recent version of the currently checked out
+# branch, cvdr will display the log message and diff of each change made
+# to the file, down to the initial version.  Each file on the command
+# line is processed in turn.
+#
+# Originally written by Fergus Henderson <fjh at cs.mu.oz.au>
+# Hacked to support branches by Tyson Dowd <trd at cs.mu.oz.au>
+#
+# Known bugs: doesn't handle the case where the initial version is on a
+# branch -- in other words this script assumes the initial version is 1.1
+# Fixing this is a bit tricky.
+
+options=
+while true; do
+	case "$1" in
+		-*)	options="$options $1"
+			shift
+			;;
+		*)	break
+			;;
+	esac
+done
+
+for file in "$@"; do
+{
+topversion="`cvs status $file 2>/dev/null | awk '
+	/  Repository revision:/ 		{ print $3; exit; }	
+'`"
+
+branch=`expr match $topversion '\(\([0-9]*\.\)*[0-9]*\)\.[0-9]*'`
+N=`expr match $topversion "$branch\.\([0-9]*\)"` 
+
+echo "Revision $branch.$N"
+
+while [ "$branch" != "" ]; do
+	while [ $N -gt 1 ]; do
+		N1=`expr $N - 1`
+		echo cvs log -r$branch.$N $options "$file"
+		cvs -n log -N -r$branch.$N $options "$file"
+		echo cvs diff -u -r$branch.$N1 -r$branch.$N $options "$file"
+		cvs -n diff -u -r$branch.$N1 -r$branch.$N $options "$file"
+		N=$N1
+		echo "Revision $branch.$N"
+	done 
+	newbranch=`expr match $branch '\(\([0-9]*\.\)*[0-9]*\)\.[0-9]*\.[0-9]*'`
+	N=`expr match $branch "$newbranch\.\([0-9]*\)"` 
+	branch=$newbranch
+done
+
+cvs checkout -p -r1.1 `sed "s^.*/imp/^^" CVS/Repository`/"$file" 2>&1
+} | ${PAGER:-more}
+done


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list