tags:

views:

204

answers:

2

How do I generate a default comment for cvs? I'd like every checkin comment to start with "Change #: " and be available for the user to edit.

I know this can be done globally in the repository. Can it also be done as a single user on the client side?

I am using command line cvs.

We already have verification that the checkin starts with "Change #: " and that a valid change number is provided. I'd like to default the checkin comment to "Change #: " to save developers some typing. How can this be done globally? Can it be done locally/client side?

+3  A: 

Be cautious. You must also ensure that the default comment does not become a crutch. For example, you should validate that the defect number is valid (currently open, for example, as well as actually exists). Otherwise, the programmers will simply use the default comment as the only comment.

In my view, it would be better to put the effort into validating the comment than into providing a default. Tell the developers that their changes will be rejected unless the comments meet the requirements - and document what is expected (and accepted).


The questioner challenges "nicely said, but does not answer the question".

Fair enough. I don't really use CVS, so take what follows with a pinch of salt.

Looking at Karl Fogel's book "Open Source Development with CVS" (Coriolis, 1999), I don't see a good way to do it. There are 'commitinfo', 'loginfo' and 'verifymsg' files that all seem to specify programs that validate log messages, and the editor is launched when the user doesn't specify 'cvs ci -m"Why I committed this"' (or, 'cvs ci -F why' for a message in a file), but personally I always checkin with comments on the command line and would hate to have an editor launched for me. So, short of writing a wrapper for the cvs command (which would be moderately complex), I don't see a way in the book of doing what you request.

Hmmm...unless you override the user's definition of CVSEDITOR in a shell script wrapper for cvs with a program that creates the default message in the given file and then launches ${VISUAL:-${EDITOR:-vim}} instead. Ick, and likewise yuck! But, done carefully, it would work. Probably the hardest part is ensuring that the programmers use your script version of cvs instead of the binary.

Jonathan Leffler
+1 - Very responsible and well thought out answer. Agree with your solution 100%.
Shane C. Mason
I updated the question. We already do the checks suggested. I'd like to default the comment for convenience and prevent developers from a typo like "Cahnge #: ..."
Alex B
This is well said, and an excellent point, but does not answer the question asked. Any ideas?
Alex B
A: 

You can use the rcsinfo file to specify a template to use for the check in.

See this page for details.

This is done server side, so you need your template files on your server.

Also, as noted above, you can override the template with your own check in comments on the CVS command line.

A_M