Contents / Previous / Next


Seting up CVS

Create a root directory for CVS and set the environment variable $CVSROOT accordingly:
 mkdir ~/cvs
 export CVSROOT=~/cvs
Set $CVSROOT permanently in you .bashrc file.

To create a repository, run the `cvs init' command. It will set up an empty repository in the CVS root:

cvs init

  OR (overwriting the environment variable):

cvs -d /home/fred/cvs init
`cvs init' is careful to never overwrite any existing files in the repository, so no harm is done if you run `cvs init' on an already set-up repository.


import: Put an Existing Project under CVS Control

Use the import command to put an existing project under CVS control:
 cd projects/swoop
 cvs import -m "Woxy starts SWOOP project" swoop Woxy start

Unless you supply a log message with the `-m' flag, CVS starts an editor and prompts for a message.
The string `Woxy' is a "vendor tag", and `start' is a "release tag".
They may fill no purpose in this context, but they must be present.

Make a backup and erase the original sources, to make sure that you do not accidentally edit them.

Check that the permissions CVS sets on the directories inside `$CVSROOT' are reasonable (that they belong to the proper groups).


Creating a directory tree from scratch

For a new project create an empty directory structure and use the import command to create the corresponding (empty) directory structure inside the repository:
 mkdir projects/swoop
 cd projects/swoop
 cvs import -m "Woxy starts SWOOP project" swoop Woxy start
Then, use the add command to add files (and new directories) to the new CVS-project.


admin: Administration

The admin command is the CVS interface to administrative facilities.

On unix, if there is a group named `cvsadmin', only members of that group can run `cvs admin'. This group should exist on the server.

Useful Options:

`-l[REV]'
     Lock the revision with number REV.
     This can be used in conjunction with the `rcslock.pl' script in
     the `contrib' directory of the CVS source distribution to provide
     reserved checkouts (where only one user can be editing a given
     file at a time). 


Administrative Files

The directory `$CVSROOT/CVSROOT' contains administrative files.

The most important of these files is the `modules' file. It defines all modules in the repository. This is a sample `modules' file.

     CVSROOT         CVSROOT
     modules         CVSROOT modules
     cvs             gnu/cvs
     rcs             gnu/rcs
     diff            gnu/diff
     swoop           projects_john/swoop
The `modules' file is line oriented. In its simplest form each line contains the name of the module, whitespace, and the directory where the module resides. The directory is a path relative to `$CVSROOT'.

Editing Administrative Files:
You can edit administrative files directly in the same way you edit other modules. To get a working copy, use:

 cvs checkout CVSROOT 
Edit the copy, and commit your changes in the normal way.


Default Options and the ~/.cvsrc File

There are some `command_options' that are used so often that you want an alias to make sure you always specify them.

In the `~/.cvsrc' file you can add default options to `cvs_commands' within cvs (instead of relying on shell aliases).
The `~/.cvsrc' file is searched for a line that begins with the same name as the `cvs_command' being executed. If a match is found, then the remainder of the line is split up (at whitespace characters) into separate options and added to the command arguments _before_ any options from the command line. Example:

     diff -u
     update -P
     commit -m
     checkout -P