Providing customized source code control with CVS
CVS is the "Concurrent Versioning System", and generally allows multiple people to be working on the same file concurrently, without bothering each other. This generally works very well, but in some cases it is necessary to restrict this facility, or to avoid using it altogether. For these purposes, CVS has the ability to mark files as being edited by one or more developers, and this can be used to implement locks as part of the development process.
For each file, CVS will maintain a list of editors (people who have specified that they are changing the file) and a list of watchers (people who want to know if anybody is editing the file). In order for this to work, it is necessary to remind people to "cvs edit" the file before they begin working on it. The CVS solution is to make the files read-only, and make them read-write when an edit is performed.
All this, of course, depends on the idea that developers will conform to the process, and not wilfully subvert it. This is not a big problem, since all software development depends on that. The voluntary lock system has generally been successful, whether the lock consists of writing in the master listing book, setting a CVS edit, a red flag, or a stuffed macaw.
How do you wish to use this facility? CVS has been shown to work fine for source code without such restrictions, since usually different developers do not work on the same parts of the same files. For binary files that cannot be merged, you might well want to make sure only one person is working on the file at a time. Alternately, you may want to permit multiple developers to work on the same file as long as everybody knows who else is working there.
The prerequisite to using this facility is to do cvs watch on
at the highest CVS-controlled directory or directories, and this will
cause CVS to make files read-only when added to a user's workspace.
Without this, the users are going to forget to use the edit facility.
(Malicious users can easily defeat this system, but malicious users
can defeat any locking system, and must be dealt with by management.)
If it is desired to do this only to certain files, such as binaries, these should be flagged when added to the repository. This is best done with the loginfo files, which will run whatever programs you want after files are checked in. The specific process:
cvs add cvs_watch_binary.pl.
cvs_watch_binary.pl
ALL cvs_watch_binary.pl %s
cvs commit -m "Add
cvs_watch_binary.pl"
All contents of these pages Copyright 2002 by David H. Thornley.
Permission granted for verbatim copying and use within an organization.