Using CVS

Here are some pointers of what a CVS session on the baselabs CVS server might look like. I have added this page to my web site, as I'm using CVS from time to time, and I always have forgotten how to use it. I hope this page will help me get back on the road when I need CVS the next time, but have forgotten how to do it. Thank god for one-click-copy/paste.

Logging in

To start a CVS session, you need to log on to your CVS server.

Changing the editor

By default, cvs uses vi as its standard text editor when editing changelog entries. I usually don't want to use vi but my favourite editor joe as I'm more familiar with it than with vi. You can set your favourite editor (joe in this case) with export EDITOR=joe.

Starting a new CVS project

This section discusses how to import a new project into the CVS server.

Checking out source code from the CVS server

In order to obtain a project from the CVS repository, do the following

Committing changes

Everytime you want to commit changes to the CVS repository, make sure that your code compiles, before checking it into the repository! Also try to keep your changes as small as possible. This gives you a couple of pluses. You can manage to document your changes. Chances to have merge conflicts with other people commiting the same lines of code become smaller. Then do the following:

Important: read that last paragraph again, get your commit comments clean and useful as a reference. Think again about making your commits as small as possible, but viable, such that the documentation clarifies your changes.

Adding or deleting files

Adding files

New files that need to go into the CVS repository are added with the following commands:

Adding directories

New directories can be added in a similar fashion to files. However, when updating the local copy of a machine that isn't aware of the new directories yet, supply the -d parameter to the update command, as follows: cvs -z3 update -d.

Deleting files

If you want to remove files from the repository, issue the following commands:

A note on compression levels

In this overview, I'm always using compression level 3 with -z3. I have discussed this in a seperate page on CVS compression levels


comments powered by Disqus