[ale] Getting CVS to do diffs.

Mike Kachline kachline at brightstar.gt.ed.net
Thu Aug 31 16:21:44 EDT 2000


On Thu, 31 Aug 2000, Mike Kachline wrote:

> 
> 	Guys,
> 
> 	I've searched both deja and the CVS man page and still haven't
> found an answer. I'm hoping that someone will have run across these
> problems at some point in time.
<snip>

	Well, after much searching and head scratching, I simply made a
solution happen. Since nobody posted a solution, I'll post the solution
which I came up with. Place this file under CVSROOT, chmod +x it, and add
the appropriate line to loginfo, and you should get emails giving both a
log and a diff for the checked in files.


			Cheers,
				- Mike
======================================
Michael Kachline 
mailto:kachline at brightstar.gt.ed.net
http://brightstar.gt.ed.net/kachline
======================================

#!/bin/bash
#
# commitmail.sh
# Script which does a "cvs log" and "cvs diff" 
# on a file(s) specified via CVS's "loginfo" file.
# The output of this script is intended to be piped to something useful (email in my case)
# to notify a mailing list of some sorts about what just changed and why.
#
# your $CVSROOT/CVSROOT/loginfo should have a line resembling:
# DEFAULT $CVSROOT/CVSROOT/commitmail.sh "%{sVv}" | /usr/bin/mailx -s "CVS Commit" whoever at whereever.com
#





echo "CVS Commit by `whoami`"
echo "Today is: `date`"


#
# Initially Set up our variables.
#
N=2
PARAMS="$@"
FILENAME="`echo $PARAMS | cut -d ' ' -f $N | cut -d ',' -f 1`"
while [ "$FILENAME" != "" ] ; do

	#
	# Set up our variables.
	#
	FROMVER="`echo $PARAMS | cut -d ' ' -f $N | cut -d ',' -f 2`"
	TOVER="`echo $PARAMS | cut -d ' ' -f $N | cut -d ',' -f 3 | cut -d \"'\" -f 1`"
	FULLFILENAME="`cvs -n status $FILENAME | grep \"Repository revision\" | cut -c 30-`"



	#
	# A nice little header.
	#
	echo ""
	echo ""
	echo ""
	echo "*********************************************************************************"
	echo "$FULLFILENAME From Revision $FROMVER to $TOVER"
	echo "*********************************************************************************"


	#
	# Do the CVS log.
	#
	echo ""
	echo "Log Comments:"
	echo ""
	cvs -n log -N -r$TOVER $FILENAME | tail +14

	#
	# Do the CVS diff.
	#
	echo ""
	echo "Differences:"
	echo ""
	cvs -n diff -r $FROMVER -r $TOVER $FILENAME | tail +7

	#
	# Change our variables for the next time around.
	#
	N="`echo \"$N 1 + p q\" | dc`"
	FILENAME="`echo $PARAMS | cut -d ' ' -f $N | cut -d ',' -f 1`"
done

--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list