[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

C.3.1 The common syntax

The administrative files such as `commitinfo', `loginfo', `rcsinfo', `verifymsg', etc., all have a common format. The purpose of the files are described later on. The common syntax is described here.

Each line contains the following:

Blank lines are ignored. Lines that start with the character `#' are treated as comments. Long lines unfortunately can not be broken in two parts in any way.

The first regular expression that matches the current directory name in the repository or the first line containing `DEFAULT' in lieu of a regular expression is used and all lines containing `ALL' is used for the hooks which support the `ALL' keyword. The rest of the line is used as a file name or command-line template as appropriate. See the descriptions of the individual script hooks for information on whether the `ALL' keyword is supported (see section The Trigger Scripts).

Note: The following information on format strings is valid as long as the line UseNewInfoFmtStrings=yes appears in your repository's config file (see section The CVSROOT/config configuration file). Otherwise, default format strings may be appended to the command line and the `loginfo' file, especially, can exhibit slightly different behavior. For more information, See section Updating legacy repositories to stop using deprecated command line template formats.

In the cases where the second segment of the matched line is a command line template (e.g. `commitinfo', `loginfo', & `verifymsg'), the command line template may contain format strings which will be replaced with specific values before the script is run.

Format strings can represent a single variable or one or more attributes of a list variable. An example of a list variable would be the list available to scripts hung on the loginfo hooks - the list of files which were just committed. In the case of loginfo, three attributes are available for each list item: file name, precommit version, and postcommit version.

Format strings consist of a `%' character followed by an optional `{' (required in the multiple list attribute case), a single format character representing a variable or a single attribute of list elements or multiple format characters representing attributes of list elements, and a closing `}' when the open bracket was present.

Flat format strings, or single format characters which get replaced with a single value, will generate a single argument to the called script, regardless of whether the replacement variable contains white space or other special characters.

List attributes will generate an argument for each attribute requested for each list item. For example, `%{sVv}' in a `loginfo' command template will generate three arguments (file name, precommit version, postcommit version, ...) for each file committed. As in the flat format string case, each attribute will be passed in as a single argument regardless of whether it contains white space or other special characters.

`%%' will be replaced with a literal `%'.

The format strings available to all script hooks are:


The canonical name of the command being executed. For instance, in the case of a hook run from cvs up, CVS would replace `%c' with the string `update' and, in the case of a hook run from cvs ci, CVS would replace `%c' with the string `commit'.


The null, or empty, string.


The name of the directory being operated on within the repository.


The name of the repository (the path portion of $CVSROOT).


On a server, the name of the referrer, if any. The referrer is the CVSROOT the client reports it used to contact a server which then referred it to this server. Should usually be set on a primary server with a write proxy setup.

Other format strings are file specific. See the docs on the particular script hooks for more information (see section The Trigger Scripts).

As an example, the following line in a `loginfo' file would match only the directory `module' and any subdirectories of `module':

^module\(/\|$\) (echo; echo %p; echo %{sVv}; cat) >>$CVSROOT/CVSROOT/commitlog

Using this same line and assuming a commit of new revisions and based on old revisions and 1.27, respectively, of file1 and file2 in module, something like the following log message should be appended to commitlog:

file1 file2 1.27
Update of /cvsroot/module
In directory localhost.localdomain:/home/jrandom/work/module

Modified Files:
	file1 file2
Log Message:
A log message.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on September, 14 2007 using texi2html 1.76.