Using CVS in the QUAGENTS (Quake Agents) Project

Expert | Overview | Repository | Using | SSH | More Info

This document describes the use of the Concurrent Version System (CVS) in the QUAGENTS project.

The percent sign (“%”) in the examples that follow indicates your shell prompt. You don't type the percent sign.


Info for CVS Experts

This information provided without explanation for CVS experts who just want to get on with it.

cvs -d /p/quake/cvs checkout quake2

If this doesn't make sense to you, please read on!


Overview

The following is a very brief overview of CVS. For much more detail, please see the CVS manual (a.k.a. “Cederqvist”) at http://www.cvshome.org/docs/manual/.


Repository

There are two ways to access a CVS repository: (1) on a local filesystem, and (2) via a CVS server (known as “pserver”). Accessing via the local filesystem is generally faster than via the server, but means that you can only update that working directory when it is on a local filesystem (for example, you can't package it up and install it somewhere else). Accessing via pserver works regardless of where the working directory is located. For people without access to the local filesystem (i.e., people outside URCS), pserver access is the only alternative.

In either case, you only need to specify the repository when you initially checkout your working directory. After that, information stored in the working directory (in the "CVS" directory, to be precise) allows CVS to find the repository.

The CVS repository for QUAGENTS is:

/p/quake/cvs
There is currently no pserver access to the QUAGENTS cvs tree.


Modules

CVS supports the notion of “modules”-- a set of files and directories that get checked out together. We use these modules to provide convenient ways to checkout various subsets of the QUAGENTS source code for specific purposes. Note that this use of the term “module” in CVS is not the same as what we mean by a “QUAGENTS module”.

Other CVS modules may be defined. The only way to know for sure is to checkout the modules list, which is left as an exercise.


Using CVS

Here we walk briefly through the use of the various CVS commands that are used most frequently.

Checking out a working directory

To start working with QUAGENTS, checkout the source tree. You should replace repository with one of the forms listed in the Expert section (either a pathname to a local repository or a pserver specification for a remote repository).

% mkdir work
% cd work
% cvs -d repository checkout -P quake2
...
% cd quake2
% rm -rf [directories that you don't care about]
The -P option to checkout means to ignore (“prune”) empty directories, which are otherwise left behind by CVS when a directory is renamed.

Checking status

When you want to check status of your files with respect to the repository:

% cvs status
or, less verbosely and much more readably:
% cvs -n -q update
That is, update, but don't actually do it (-n) and don't be verbose about it (-q). This is so handy that you might want to make an alias for it. With no arguments, both of these commands will do the current directory and, recursively, any sub-directories. Or you can specify specific files for it to check by given them on the command-line following the command.

The meanings of the various letters in the output of cvs update is as follows:

U
An updated version of the file is available and will be checked out if you do an update.
M
You have modified your copy of the file but not committed the changes.
C
You have modified your copy of the file, and there is a conflict between your changes and the copy currently in the repository (ie., someone else has checked in conflicting changes).
A
The file has been scheduled for addition with cvs add but the addition has not yet been committed.
R
The file has been scheduled for removal with cvs remove but the removal has not yet been committed.
?
The file is not under CVS control (use cvs add to add it).

Getting other developer's changes

To put your working directory in sync with the repository:

% cvs update

Throwing away your changes

If you decide that you want to discard any changes to your working copy of some file (rather than committing them) and just want a fresh copy of the last checked-in version:

% rm foo.lisp
% cvs update foo.lisp
CVS will warn you that “foo.lisp was lost” and get you a new copy, which is what you wanted.

Committing your changes

Once you're ready to commit your changes to the repository and make them available to others (when they update):

% cvs commit -m 'Message for log'
You will be left with an up-to-date tree after committing (ie., no need for separate update).

Adding and removing files and directories

Neither of these operations takes effect until the changes are committed.

To rename a file, just cvs remove the old name and cvs add the new one.

To add (place under CVS control) a new directory, use cvs add as with a file, but note that the change will take immediate effect (you will see a "CVS" directory in your working copy of the new directory, and the repository will have a new, empty, directory in it also).

Removing a directory is not really supported by CVS. See the docs for more comeplete discussion. The “solution” is to cvs remove all the files in the diectory, and assume that people use the -P option to cvs checkout to avoid seeing empty directories.

Using tags

Using branches



For more information


Dave Costello
Last change: 15 Dec 2003