One of the cool things about CVS that I've found incredibly useful at work is getting commit (check-in) notifications via e-mail. I've long wished I knew how to set that up for some of my personal repositories. Specifically, I had my book repository in mind. Since there are two of us collaborating, it'll be easier to know when the other has done something.

It turns out that it's really not rocket surgery at all. In the CVSROOT directory is a file called loginfo. By adding a line like this to it:

^book /usr/bin/Mail -s [book cvs]: %s authors@highperformancemysql.com

We're able to get the e-mail upon commit. More information is here in the CVS manual.

Posted by jzawodn at November 08, 2003 06:27 PM

Reader Comments
# Justin said:

'rocket surgery' - I like it!

But yeah, CVS mails are the business -- perfect for code reviewing. Does that stanza provide diffs of the changes in the mail?

on November 8, 2003 06:37 PM
# Jeremy Zawodny said:

No diffs, just the commit message and file(s) affected. There's a way to diffs, but for this I'm not terribly interested in 'em. For code they're great, though.

on November 8, 2003 06:43 PM
# Brad Fitzpatrick said:

We have CVS commits both going to email to a bunch of people, plus to a changelog journal:

http://changelog.livejournal.com/

And that's the format of our emails too, with links to review the patches.

We also have support for subjects (commit message begins with [subject]) and private commits (for security stuff) that only show up to core developers on the journal URL above.

This is in no way praise for CVS, though. It was ugly getting it all integrated. And we still have permission hell all the time.

I'm curious to try arch or subversion, but I haven't gotten around to trying either.

on November 8, 2003 07:04 PM
# Steve Friedl said:

Derek's actually *doing something* on the book? :-)

on November 8, 2003 07:20 PM
# Eric Hancock said:

Have you looked at CVSSpam? Even nicer.

on November 8, 2003 07:59 PM
# Jeremy Zawodny said:

Holy Crap!

CVSSpam is pretty damned cool. :-)

on November 8, 2003 08:08 PM
# kellan said:

activitymail is my favorite of the CVS email scripts

but really, i've given up using email notification of commits in favor of cvs2rss

on November 8, 2003 08:14 PM
# Craig said:

You can only partly do diffs -- there's a problem when you have spaces in either filename or CVS module name -- you can deal with space in one, but not both, do to a lack of separators and/or whitespace escaping in the expansion of %{sVv}. It's particularly problematic when you have multiple files checked in simultaneously. perl script to at least handle some of this stuff is here -- adapt to taste.

on November 8, 2003 08:47 PM
# Patrick Fitzbrad said:

Sounds more like brain science.

on November 8, 2003 09:02 PM
# Martin Jansen said:

You might want to have a look at how cvs.php.net does the job. (http://cvs.php.net/cvs.php/CVSROOT)

on November 9, 2003 04:41 AM
# Courtney said:

Er, can I be a total ignoramus and ask what, exactly, is a "commit (check-in) notification"? Pah-wease? with sugar on top?

on November 9, 2003 10:30 AM
# kasia said:

ooh, cvsspam is cool.. I'll have to dump it on our cvs box at work.. assuming I don't blow it up in the process, I don't have good track record with it.

on November 9, 2003 10:34 AM
# Rasmus said:

I must be dense, but what is cool about HTML-formatted commit messages? Just stick a nice diff -u like we do at cvs.php.net and you are not going to piss off the folks doing the real work.

on November 9, 2003 12:17 PM
# David said:

Everybody is writing for O'reilly nowadays..
I'm going to have to re-cook the CVS repository on our server so I can try out CVSSpam..its been broken for awhile now :)

on November 9, 2003 03:52 PM
# Ryan Lowe said:

Updated URL

on January 5, 2005 11:42 AM
# Bharath R said:

Thanks Jeremy. Your post (after all these years :-)) helped me address a slightly similar requirement.

on December 18, 2006 03:38 AM
# superbiji said:

goooooooood idea
thanks

on December 5, 2007 11:03 PM
# Todd said:

Thanks for this - I've got it going, and have added diffs and so on to it. Fantastic.

on September 29, 2008 02:25 PM
# David said:

Jeremy,

Thanks for your post, I am getting a 404 on link provided 'in the CVS manual' www.cvshome.org/docs/manual/current/cvs_18.html#SEC171

Does it give you the commit description, and the new files committed?

If the commit touches multiple files, does it send an email on each file touched?

or include all the files touched in the commit in one email?

Thanks in advance.

on November 24, 2009 07:39 AM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.