Is it possible to use the commit message in a pre-commit hook in CVS? The CVS server is running remotely, and I access it using pserver.
Ideally, I want to allow the commit if the files pass the filter or the commit message contains certain text.
I don’t have a choice to use another versioning system.
Here are some useful tutorials to read more:
http://durak.org/sean/pubs/software/cvsbook/The-commitinfo-And-loginfo-And-rcsinfo-Files.html
http://durak.org/sean/pubs/software/cvsbook/The-verifymsg-And-rcsinfo-Files.html#The-verifymsg-And-rcsinfo-Files
You can’t do what you want with just one hook but you can use two hooks,commitinfowill let you verify the files themselves andverifymsgwill let you verify the message. Both can be used to cancel the commit (the programs just need to exit with status 1). In case you weren’t aware,checkoutlist,commitinfoand ‘verifymsg’ can all be found in the CVSROOT directory of your repository. I would recommend putting any scripts you write as hooks in that directory as well, but it doesn’t really matter as you get to specify the full path. Also, perl is not necessary or required, just simple for me to write some (silly) examples in:checkoutlist
verifymsg
acceptable
Caveat emptor: I wrote most of this off the top of my head with no testing so I can’t guarantee it works but it should get you at least close.
Edit again, I just realized that I was originally wrong and you can pass both the logfile and the committed filenames to
verifymsgmaking the answer quite a bit simpler.