4.4. Automatic e-mail on commit

Often it is very helpful to have a commit mailing list that keeps developers up-to-date on every commit happening to the CVS. To setup automatic e-mails on every commit, put the following in

/rep/CVSROOT/loginfo:

ALL     /usr/bin/cvs-log     $CVSROOT/CVSROOT/commitlog $USER "%{sVv}"

This tells CVS to pipe the commit output to a shell script, which in turn updates a log file and e-mails an update (typically to a mailing list address). Create the shell script at /usr/bin/cvs-log that is executable by the cvs user (using "chmod 755 /usr/bin/cvs-log").

/usr/bin/cvs-log:

#!/bin/sh
(echo "----------------------------------------------";
 echo -n $2"  ";
 date;
 echo;
 cat) | tee -a $1 | /usr/bin/Mail -s "[foundation-cvs] $3" foundation-cvs@example.com

Your commit logs will now be archived in the CVSROOT/commitlog file and e-mailed to the foundation-cvs@example.com address (which is especially useful when you have a Mailserver for CVS updates). Here is what a sample e-mail looks like:

Subject: [foundation-cvs] 'directory/subdirectory filename.c,1.7,1.8'


----------------------------------------------
cvs Fri Mar 16 21:14:09 PST 2001
Update of directory/subdirectory
In directory cvs.foundationsomething.com:/tmp/cvs-serv7721
Modified Files:
filename.c
Log Message:
test

Now you have a working CVS development system. At this point it may be valuable to learn more about CVS the client tools that you are using.