Created at:

CVS notes

CVS setup

This file shows the set of the commands to create a CVS repository in a local computer and start to work with it. Useful information can be found in the cvs(1) manual page and also in the following documentation:

CVS documentation

First, export your CVSROOT environment variable for the repository root directory. For example:

    $ export CVSROOT=/home/user/cvs

Then, create the repository with the following command:

    $ cvs -d /home/user/cvs init

After creating it, cd your project root directory and use the command cvs import to put files there:

    $ cvs import -m "Log Message" project_name_in_cvs/ vendortag releasetag

I don't know, yet, what vendortag or release tag mean.

To download information from CVS to your working directory, run the following command on the a directory where you put project directories (See that, unlike cvs import, you don't run it in the project root directory, but one level above.):

    $ cvs checkout project_name_in_cvs/

Now, suppose you changed a file and need to update the CVS repository. Just commit it:

    $ cvs commit -m "commentary for changelog" filename

See that you need to checkout the directory that the file you are editing is in before doing the commit.

Now, if you need to add a new file to the repository, use the add command and commit it:

    $ cvs add filename
    $ cvs commit -m "commentary for changelog" filename

I got some errors when I tried to add a file whose filename is the same as the project name. Don't know why... maybe I was doing something wrong.

Ok. It might be enough to set and use a simple cvs local server. The next steps will show us how to configure the system to allow remote use, i. e., allow users of other machines (on a LAN or not) commit, checkout, add and delete files.

On BSD systems (at least on NetBSD) it is not necessary to set the CVS_RSH environment variable (according to a friend), but it is on other systems. It is made to use the ssh protocol. Steps for using other protocols are different.

    $ export CVS_RSH=ssh

Making a commit remotelly is exactly the same as making it locally. Also is other operations, but the repository address is diferent, so it is necessary to pass the -d flag to the cvs command, or set the CVSROOT environment variable, with the following content:

    export CVSROOT=:ext:user@host:/path/to/repository

It is enough, for now.

CVS tips

Syncing trunk and branch

Sometimes it is necessary to get a change made in HEAD and add it in a Branch. To make this sync, do:

1. checkout the branch 2. update -r HEAD the files 3. commit the new files in the branch

Sometimes it is necessary to do the opposite: sync changes in branch to the trunk:

    $ cvs checkout $module
    $ cd $module
    $ cvs update -j HEAD -j $branch
    $ cvs commit

Tags and branches

To tag a repository, enter at the workdir and type:

    $ cvs tag <tagname>

To create a branch from a tag, type:

    $ cvs tag -r <existing tag> -b <branchname>

To delete a tag use the -d flag:

    $ cvs tag -d <tagname>