Skip to main content

Script to create full CVS Changelogs

Background

CVS Commit histories are saved file-by-file. In my coursework we were required to use a CVS repository to create a group project.

Why did I do this?

I didn't like having to check individual files to find out what's been changed so I did some looking and found cvs2cl that would create a changelog.

How I solved the problem

Luckily I have a Raspberry Pi sitting around so I created this script to automatically create full changelogs each time a new commit was found. (Mine checks every 15 minutes for new commits).

Several things one would need to do to replicate this setup.

1) Checkout the project from the CVS repo manually
2) Update the regex on line 15 to match the username naming scheme
3) Install cvs2cl
4) Install/setup exim4 (which allows me to send email through my secondary Gmail account)
5) Change YOU@DOMAIN.COM to the email you wish the log to be sent to.
6) Edit crontab to have the script run automatically (or set it up some other way)


NOTE: The regex on line 15 would need to be changed. This looks for the first UofM username, which starts with "um" all the time.
#!/bin/sh
cd /path/to/local/cvs/repo/
output="$(cvs -qn update)"
echo $output
if [ -x "$output"]
then
        echo "No Updates."
else
        echo "New commit available!"
        echo "Updating..."
        cvs update -C -d
        echo "Creating ChangeLog..."
        cvs2cl;
        sleep 2
        person="$(grep -o -m 1 'um*\w*' ChangeLog)"
        echo $person
        echo "Sending email..."
        mail -s "New Commit by $person. Full ChangeLog Below" YOU@DOMAIN.COM < ChangeLog
        sleep 2
        echo "Removing ChangeLog..."
        rm -f ChangeLog
        echo "Mission Complete."
fi

(Script also available on github)

Questions, Comments, Criticism are welcome below!

Comments