ShaliniCVS - Version control

Home
Research
CVS - Version control
Networked Scene Graph
Benchmarks - pixel reads
Resume
Publications
Course work
Miscellaneous

This document describes how to use CVS for version control and code management. As of now, there are only 2 projects in CVS - CAVERNsoft and the higher-level modules.

Setup

Set the CVS environment variable to point to the CVS code repository which is in /nfs/cavern/cvs. In your .tcshrc add

setenv CVSROOT /nfs/cavern/cvs

To get your working copy of cavernsoft, type

$ cvs checkout cavern

This will create a new directory called 'cavern' and populate it with the source files

$ ls cavern
CVS Makefile.IRIX demos/ src/ include/ ...

The 'CVS' directory is used internally by CVS and shouldn't be modified. Likewise, for modules type

$ cvs checkout modules

This will create a new directory called 'modules' and populate it with the source files. Now, you can proceed to make any code changes.

Committing Changes

Since each developer uses their own working directory, the changes you make to your working directory aren't automatically visible to the other developers on your team. When you are done testing your changes, you must commit them to the repository to make them available to the rest of the group.

But before you can commit your changes, CVS requires your sources to be in sync with any changes that may have been committed by the other team members.

For example, if you have changed the file CAVERNdb_c.cxx in the directory src

$ cd cavern/src
$ cvs update
cvs update: Updating .
U CAVERNdb_c.cxx

$ cvs commit CAVERNdb_c.cxx

Alternatively, just typing

$ cvs commit

without any filenames will recursively check for all the files modified in the current directory and commit them.

CVS now starts an editor(default vi), to allow you to enter a log message. When you exit the editor, CVS will commit your changes. To change the default editor, set the EDITOR env variable.

Viewing Differences

$ cvs diff [filename]

will run diff to compare the version of [filename] in your local directory with that in the repository. This is helpful when you want to know the changes you made to this file.

Adding Files/Directories

Eg. To add a new dir docs containing a file README in the cavern/demos dir.

$ cd cavern/demos
$ ls
docs/ db/ ...
$ cvs add docs
$ cd docs
$ ls
README
$ cvs add README
$ cd .. (back to the docs dir)
$ cvs commit

Note that 'cvs add' command is not recursive. The 'cvs commit' must be called after adding to update the repository. CVS now starts an editor and prompts for a log message.

Tagging versions

This useful feature in CVS allows you to give a symbolic name to the current state of any files or the whole distribution. For example, to freeze the current state of cavern as CAVERNG2_1.2

$ cd cavern
$ cvs tag CAVERNG2_1.2 .

This will assign the tag CAVERNG2_1.2 to all the files in the cavern dir recursively. So, at any time in the future to retrieve this version 1.2,

$ cvs checkout -r CAVERNG2_1.2

Adding a new project

This is if you already have an existing directory structure and want to add this into CVS.

Eg. To add the dir tide2 together with all its subdirs and files.

$ cd tide2
$ cvs import tide2 evl 1.0

This will create a new project tide2 in the repository and add to it all the files. So, files like exe's and .lib's which are not to be stored in CVS should be removed locally before doing this. The last 2 parameters evl and 1.0 serve no purpose in this context but CVS requires them.

Additional Documentation

Official CVS Manual - http://cvshome.org/docs/manual/cvs.html