Getting email notifications of CVS commits

I always knew that there must be some such feature already in CVS, but just never got around to checking it out. Until now! So, here it goes:

If you want to get automatic email notifications (or want to do something else) when users check in code into CVS, it is rather simple to do:

  1. Log in to the CVS server, and go to the CVSROOT folder.
  2. Edit the loginfo file. By default, this file exists, and has a few comments. You can add a new line at the end, that says something like:
    src/com/yourcompay/p1/* echo “File %{sVv}” | mail -s “p1 commit”

Basically, the sytax of the loginfo record is:

  • Pattern of the file to match
  • Followed by command that should be run when a file matching the specified pattern is checked in. %s, %V, %v and %t are special variables that stand for full file name (%s), old version number (%V), new version number (%v) and tagname (%t).

The downside of this feature implementation however is that there is no way to filter out by tagname (if you want to get notifications only on certain tag, or trunk). Also, there is no way to filter out just by a person (say, if you have a problem developer). Also, no way to include the CVS diff in the email. Oh well.

Enter Comments