Thornleyware logo

Providing customized source code control with CVS

Logging in CVS

Decisions:

CVS logs some events itself, and many others can be logged automatically. It normally maintains a history file with entries about each file checked out, tagged with cvs rtag, released, updated and changed, committed or exported.

It is also possible to set CVS up to log other events. You can set it up to run arbitrary programs on any tag operation or any checkin operation. These are normally provided to verify the operations, but there are no restrictions on what they can do.

One possibility is to keep a record of all changes to the repository, so as to be able to recreate it in case of any loss of data. If the changes are immediately written to a medium such as tape, or sent to another system (by email, perhaps), this allows all changes to be recovered in case the CVS server crashes.

Process:

Maintaining the normal history file is easy: make sure there is a file named "history" in CVSROOT in the repository, and that it is world-writeable (chmod ugo+rw). This may be accessed through the cvs history command. The history file can grow too large, so it is often a good idea to set up automatic trimming according to the housekeeping instructions.

Other than that, the formula is simple. The commitinfo, loginfo, and taginfo files contain hooks to run programs on commit or tag operations. (The difference between commitinfo and loginfo is that commitinfo is run before the commit, and can abort it.) They call the given programs with arguments as specified by the given info file.

When you write a program to do this logging, you need to keep it secure. The usual way to do that is to write shell scripts or Perl programs or something else readable and executable, and keep them in CVSROOT inside the repository. These should be checked in in the normal way, to keep track of them. Their names need to be added to the checkoutlist file, so that they will be kept in the repository in checked-out form.

All contents of these pages Copyright 2002 by David H. Thornley.
Permission granted for verbatim copying and use within an organization.


Contact: webmaster@thornleyware.com