Finn Lindgren, CVS help (old page)

Creating the repository

CVS stores the entire revision history in a repository.

[TODO: How to create the repository.]

Creating a new project

[TODO: How to create a new project from existing files..]

Retrieving a project for your workplace

The project repository can be accessed through ssh, by setting the environment variable CVS_RSH. Use export CVS_RSH=ssh for shells like bash (in Cygwin, add the command to /etc/profile). For tcsh, add setenv CVS_RSH ssh to your .cshrc file.

cd /some/location/
cvs -d checkout projectname
This will create a directory named /some/location/projectname/, which will be your local work copy of the project.

The update/edit/commit-cycle

To incorporate your co-authors changes inte your local copy, run
cvs update -d
which retrieves the latest versions from the repository, as well as any new directories.

Pay attention to the messages printed by the cvs command; There may be conflicts between your local changes, and the versions in the repository, which have to be resolved before you enter your own changes into the repository.

When you want to add your own changes to the repository, run
cvs commit -m 'Brief modification description'

Always do an update before commit, to incorporate the modifications of others. cvs will not accept a commit on a file with conflicting changes.

The basic work cycle is as follows:

  1. cvs update -d
  2. Modify/Add new text to the files
  3. cvs update -d
  4. cvs commit -m 'This is what I did.'

Adding/removing files and directories

Use cvs add filename.ext to add a textfile filename.ext to the CVS system.
Use cvs add -kb binaryfile.ext to add a binary file binaryfile.ext to the CVS system.
The file must exist before adding it.

Use cvs remove filename.ext to remove the file filename.ext. The local work copy must be deleted first. The file is kept in the repostitory, so it can be resurrected at a later time.

Avoid renaming files. I unavoidable, rename the local file copy, cvs remove the old filname, and cvs add the new filename.

Adding directories follows the same track as files. Removing a directory however, is done by removing all the files in it, and adding the option -P to the cvs update-command, which will remove all empty directories from your local work copy.

Accessing the version information

Every version of every file is assigned a revision number, typically 1.1, 1.2, 1.3, etc., which is updated each time a file is changed during a commit.

To see the commit messages for the entire history of a file, use
cvs log filename.ext

cvs diff filename.ext displays the difference between the latest seen repository version, and your local work copy. You can access the differences to a specific file revision with the option -r:
cvs diff -r1.3 filename.ext