Using CVS

After showing Chris the ropes with CVS I thought it might be nice to have a mini-cheat sheet!

Enviromental Settings

CVSROOT and CVS_RSH are the two enviromental variables that I use when setting up CVS. For a local repository its easy:

$ export CVSROOT=/path/to/local/repo

For a remote CVS repository you could have a pserver:

$ export CVSROOT=:pserver:user@host:/path/to/repo

Or allowing a more secure method with SSH

$ export CVSROOT=:ext:user@host:/path/to/repo
$ export CVS_RSH='ssh'

Creating/Preparing a Repository

You can create an empty repository like this (use -d /path/to/repo if CVSROOT isn't set):

$ cvs init

Use cvswrappers to help with using binary files:

$ cvs co CVSROOT
$ vi CVSROOT/cvswrappers
$ cvs commit -m 'Addition of binary files' CVSROOT/cvswrappers
$ cvs release -d CVSROOT

In the file you should have something like this:

*.png -k 'b' -m 'COPY'
*.zip -k 'b' -m 'COPY'

It is easy enough to add existing code to a repository:

$ cd /path/to/sources
$ cvs import dir vendor release

Where dir is the new module name, vendor is the project groups name and finally release is the starting tag. After this you can checkout the module somewhere (and remove the original source.

$ cd /new/cvs/source/path co dir
$ rm /path/to/sources

Daily stuff

Add a file: cvs add file or a binary file cvs add -kb binaryfile

Remove a file: cvs remove -f file

Check to see what would be updated cvs -n update

Actually update: cvs update -d

Commit changes: cvs commit -m 'Message for the log'