Expansions in administrative files

Sometimes in writing an administrative file, you might want the file to be able to know various things based on environment cvsnt is running in. There are several mechanisms to do that.

To find the home directory of the user running cvsnt (from the HOME environment variable), use ~ followed by / or the end of the line. Likewise for the home directory of user, use ~user. These variables are expanded on the server machine, and don't get any reasonable expansion if pserver (the section called “Direct connection with password authentication”) is in use; therefore user variables (see below) may be a better choice to customize behavior based on the user running cvsnt.

One may want to know about various pieces of information internal to cvsnt. A cvsnt internal variable has the syntax ${variable}, where variable starts with a letter and consists of alphanumeric characters and _. If the character following variable is a non-alphanumeric character other than _, the { and } can be omitted. The cvsnt internal variables are:

CVSROOT

This is the name of the current cvsnt repository as the user sees it.

VIRTUAL_CVSROOT

This is the name of the current cvsnt repository as the user sees it.

REAL_CVSROOT

This is the physical location of the current cvsnt repository. Avoid displaying this value to users as it is an information leak.

CVSEDITOR

VISUAL

EDITOR

These all expand to the same value, which is the editor that cvsnt is using. the section called “Global options”, for how to specify this.

USER

Username of the user running cvsnt (on the cvsnt server machine). When using pserver, this is the user specified in the repository specification which need not be the same as the username the server is running as (the section called “Setting up the server for Authentication”).

CVSPID

Parent process ID of the cvsnt process.

SESSIONID

COMMITID

Unique Session ID of cvsnt process. This is a random string of printable characters that may be up to 256 characters long.

If you want to pass a value to the administrative files which the user who is running cvsnt can specify, use a user variable. To expand a user variable, the administrative file contains $variable. To set a user variable, specify the global option -s to cvsnt, with argument variable=value. It may be particularly useful to specify this option via .cvsrc (the section called “Default options and the ~/.cvsrc and CVSROOT/cvsrc files”).

For example, if you want the administrative file to refer to a test directory you might create a user variable TESTDIR. Then if cvsnt is invoked as

cvs -s TESTDIR=/work/local/tests

and the administrative file contains sh $TESTDIR/runtests, then that string is expanded to sh /work/local/tests/runtests.

Environment variables passed to administrative files are:

CVS_USER

The cvsnt-specific username provided by the user, if it can be provided (currently just for the pserver access method), and to the empty string otherwise. (CVS_USER and USER may differ when $REAL_CVSROOT/CVSROOT/passwd is used to map cvs usernames to system usernames.)