Skip to content

Intro

Checkout code

In CVS, you check out a repo to download its files:

$ cvs -d anoncvs@example.com:/cvs checkout -P module

You want to replace anoncvs@example.com with the username and hostname for the repo.

You'll also want to verify the SSH fingerprints. IRCNow publishes a list of known SSH fingerprints.

For example, to check out code for ircnowd from anoncvs@anoncvs.ircnow.org, you'd run:

$ cvs -d anoncvs@anoncvs.ircnow.org checkout -P ircnowd

The checkout commands produce a copy of the code in the working directory.

Commit new code

Once you checkout a CVS repo, you can edit the code and save your changes. Until you commit your code, however, none of the updates will be saved in the CVS repository. WARNING: Any code that is not committed will not be saved in the CVS repo.

When you are ready to commit your code, type:

$ cvs commit

You will be given a text editor (usually vi) to leave a commit message.

To commit and also write the message in a single command, type:

$ cvs commit -m "Your commit message goes here"

Update code

To update your working directory with new code from the repository, type:

$ cvs update

Add new files

WARNING: If you create a new file in your working directory, it will not automatically be added to the CVS repository. You must first run:

$ cvs add filename

Replace filename with your real filename.

Then, you must commit your changes with:

$ cvs commit

Note: cvs add is only used for adding new files to a module that has already been checked out. If you want to add a new project to the repository, use cvs import as described in Import New Repo.

Remove files

To remove files from the CVS repo, it is not enough to simply delete them

from the working directory. You will also want to remove them from the CVS repository:

$ cvs remove filename

Afterwards, you must commit this change to delete it from the repository:

$ cvs commit

Setting CVSROOT

When working with CVS, it helps to set the CVSROOT, the path where the cvs folders are located:

You can set it for just the current shell:

$ export CVSROOT="anoncvs@example.com:/cvs"

If CVS is local, you can use a file path:

$ export CVSROOT="/home/username/CVS"

As a shortcut, you can add this to the bottom of your ~/.profile so you don't have to type it each time:

$ echo 'CVSROOT="anoncvs@example.com:/cvs"' >> ~/.profile

Once CVSROOT is set, you can then omit the -d argument for checking out and committing code.

So the checkout code above becomes more simple:

$ cvs checkout -P module

Any time you check out code, the CVSROOT is automatically provided for the code in the working directory. So, it was not necessary to specify the CVSROOT for the commit command.

Create New Repo

To create a new CVS repository, type:

$ cvs -d /path/to/CVS/ init

Replace /path/to/CVS/ with where you want the CVS repository to be located. For example, you might put it in ~/CVS.

Import New Module

If you have existing code that you'd like to import to a CVS repository, first change

to the folder containing the source code, then type:

$ cvs import reponame vendortag releasetag

Replace reponame, vendortag, and releasetag. CVS will put the source files inside a directory named reponame inside the CVS root directory. vendortag should be replaced with the vendor (the author) of the repository. releasetag is the tag for the specific release.

For example:

$ cd ~/ircnowd/
$ cvs import ircnowd ircnow start

Note: CVS does not automatically transform the imported source code into a working directory. As a result, any changes you make to the original source code directory cannot be committed to the CVS repo.

To fix this, you will need to checkout the source code. Change your directory to somewhere else to place the new working directory, then type:

$ cvs -d /path/to/CVS/ checkout -P reponame

Replace reponame with the repository name. Then, change directory to reponame to make changes. Afterwards, use cvs to commit them.

If checkout works properly, you can safely delete the old source code directory you imported from (since that one is not tracked by CVS).

Export code

Eventually, when you are ready to use the code, you want to remove all the CVS-related files. To export code for use:

$ cvs -d anoncvs@example.com:/cvs export -D YYYYMMDD module

Replace YYYYMMDD with the year, month, and day of the version of the repository you want to export. Replace module with the module name.

Troubleshooting

If you see this error message:

cvs [commit aborted]: received broken pipe signal

It may be because CVS was waiting for you to connect but your connection took too long. This can happen if you take too long to send a commit message or you take too long to provide passwords for your ssh keys. If this happens, try to find ways to avoid interactive input. For example, you might consider using the -m argument with cvs commit.

cvs [server aborted]: cannot make directory /var/cvs/module: Permission denied

This error message means that /var/cvs either doesn't exist or has the wrong permissions. If you're running cvs inside a chroot, check var/cvs inside the chroot. It needs to exist and be owned by the group commit and set to group writeable.