CS3 page · Project Overview

CVS by numbers

This is a very brief outline of how to start using CVS for phase 1 of the CS3 individual programming project.

CVS is a revision control system: it can keep track of all the files in your project, noting which ones change when. You can read about why you might use revision control.

The general method for using the system is as follows. CVS maintains a repository that holds master copies of your project files. You should not touch the repository directly: instead you check out a working copy of the files. Every now and again, when you have made a significant change, you can commit a new version into the repository. CVS keeps a log of all this, and there is enough information in the repository to reconstruct all current and past version of your files.

The authoritative reference is the manual Version Management with CVS by Per Cederqvist. We have a local copy in dvi, pdf, and postscript. You can find out more at the CVS home page, and at this list of other CVS resources.

Starting CVS

We assume that you have not used CVS before, and have not started writing code for your project. If you have done either, adjust the recipe to taste.

Type the following at the command line.

cd ~ Start in your home directory.
export CVSROOT=~/Repository Decide where to put the repository.
mkdir -p $CVSROOT/ipp1 Create some empty directories.
cvs init CVS will put some administrative files in the repository.
cvs checkout ipp1 Get a working copy.
chmod og-rwx $CVSROOT ipp1 Make sure your project can't be seen by all the world.
cd ipp1 Nothing is there at the moment, except an administrative directory called CVS. Ignore it.
... Create a project file in the editor of your choice. It doesn't have to have very much in it at this stage.
cvs add file Tell CVS you have a new file that you want tracked.
cvs commit -m"comment about file" If you miss out the comment, CVS will start up an editor for you to write one.
... Now work on your project file, or create some new ones and tell CVS about them with cvs add.
cvs commit -m"comment about changes"
And repeat...

From inside the ipp1 directory you can interrogate CVS in various ways.

cvs history Ask what happened when.
cvs log file Find out more detail for a particular file.
cvs status file Discover the current situation for a file.

If you spend your programming life inside emacs, then you can try the command M-x cvs-update. This invokes the pcl-cvs package for controlling CVS from within your editor.

CVS allows you to check out several working copies of your source files, and will help to keep them synchronised. Most importantly it can do this over the internet: if you have your own computer then you can use CVS to download a mirror copy of your project files. See the manual for full details. If you do this, then for privacy you ought to consider using ssh, the secure shell.

Automated commit

You should make sure that you commit your project files at all "significant moments"; such as when they work. The cvs tag command lets you label notable versions.

In addition, you can arrange for an automatic commit every night. This uses a crontab file to tell the cron dæmon what you are want doing.

To set things up, first connect to a central server machine. rterm scar will do this nicely. Then enter the following.

crontab -f <<END
12 1 * * * cvs commit -m"Nightly commit" $HOME/ipp1

At 1.12am every morning, scar will commit all of your project files that have changed during the day. Use crontab -e to change the entry, or crontab -r to remove it completely. If you adjust things yourself, please stick to times between 10pm and 2am; the rest of the night is used to carry out other automatic backups.