Tracking Changes in CVS
Pages: 1, 2
cvs log command displays information about the file or files in the argument list. If no files are listed, it displays log information about all files in the current working directory and its subdirectories.
The options to
cvs log reduce the amount of information it shows. By default,
log displays all its information.
$ cvs log cvs_changes.html RCS file: /home/cvs/oreilly/articles/cvs/cvs_changes.html,v Working file: cvs_changes.html head: 1.3 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: ---------------------------- revision 1.3 date: 2002/05/15 15:41:54; author: jenn; state: Exp; lines: +53 -0 history mostly done. needs example. ---------------------------- revision 1.2 date: 2002/05/15 15:04:47; author: jenn; state: Exp; lines: +8 -2 Adding a history file ---------------------------- revision 1.1 date: 2002/05/15 14:54:54; author: jenn; state: Exp; Initial entry for both files. Also includes cvs annotate for changes. =============================================================================
Example 6 shows the early
log history for this article.
Revision 1.1 occurred when I created two files, forgot to check-in the empty templates, and tried to commit the annotate section of this article.
CVS has customization files that define scripts to be called when certain actions occur. The
loginfo, modules, and
taginfo files can be used to call logging scripts.
These files can be found and configured in the CVSROOT directory in the CVS repository. The files are run on the computer that hosts the repository, but some module scripts are run from the client machine. See that section for more detail.
Use CVS when editing these files -- they are in the module CVSROOT. Simply
cvs -d repository checkout CVSROOT to check out all these files.
loginfo and taginfo
loginfo file controls where log information for
cvs commit is sent. Potential uses include keeping a project leader informed of changes her team makes, and maintaining a central log of a project's progress.
taginfo does the same, but for the
rtag commands. It has the same syntax as
Each line of the file should contain a regular expression that matches a directory, followed by the address of a script, which expects log information as the standard input (stdin).
The special lines start with 'ALL' and 'DEFAULT'. ALL runs cumulatively with any other line that applies. Otherwise, only the first matching regular expression is run, or DEFAULT if none match.
loginfo file in example 7 would log every commit through a script called
cvsscript if any file under $CVSROOT/oreilly is committed, and would mail any other commits to cvsadmin.
ALL /usr/local/bin/logscript ^oreilly /home/jenn/scripts/cvsscript DEFAULT Mail -s "CVS commit" cvsadmin
CVSROOT/modules records each module and its directories and files. The file also takes options, and some of the options are scripts to be run when CVS actions occur.
- run the script when the module is exported.
- run when the module is committed.
- run when the module is checked out.
- run when the module is updated.
- run when
rtagis used on the module. This does NOT run when
tagis used. The
taginfofile is a better way to log tags.
Please read the manual and info files for CVS if you are changing this file. CVS uses this file every time a user interacts with a module.
Scripts called from a commit or an update are run from the local machine, and scripts called from the rest are run from the server.
Example 8 would run
/home/jenn/scripts/cvsscript when the oreilly module is checked out, from the directory oreilly. It also defines the module CVSROOT, with no special options.
CVSROOT CVSROOT oreilly -o /home/jenn/scripts/cvsscript oreilly
Change-tracking is a useful part of CVS, but I've rarely seen it used in the field. I discovered it when I started using CVS on my own, and had one of those, "Why have I never used this before?" moments.
Try it. I hope you find it as useful as I do.
- Introduction to CVS
Jennifer Vesperman is the author of Essential CVS. She writes for the O'Reilly Network, the Linux Documentation Project, and occasionally Linux.Com.
Return to the Linux DevCenter.