Using CVS in the CSUGLab

Introduction

CVS is a revision control system that makes it easier for several people to work simultaneously on a software project while maintaining their own separate working areas. Changes to the source code are only distributed to other users when they are explicitly committed using the "cvs commit" command. Changes made by other users are only seen when they are explicitly requested via a "cvs update" command. CVS provides many other useful capabilities, and the use of this software is highly recommended for your compiler project. See the CVS manual pages for a detailed description of how to use CVS.

Getting CVS

Download cvs-1.10-win.zip.  Extract the archive into the directory of your choice.

Setting up a environment variables

Before you can use CVS, you must set up a few environment variables.  To do this on the NT machines in CSUGLab, right click on the My Computer icon and choose Properties. 

Select the tab labeled Environment. 

Make sure the TMP variable is set to a directory to which you have write-access. 

Add the directory containing the contents of the CVS archive to your PATH variable.

Add the variable CVSROOT with a value of :local:<drive letter and directory for your file repository>.  For example, if you wanted the repository to reside in z:\test1\repository, you would set CVSROOT equal to :local:z:\test1\repository.

Creating a repository

After you are sure the environment variables are configured properly, you can create a directory for storing your file repositories by opening an MS-DOS prompt and executing :

cvs init

This will create a directory for repositories specified by your CVSROOT environment variable.

Next, you can create a file repository.  Change to the directory containing your project files and execute the following command :

cvs import -m "<comment>" <project name> <vendor tag> <release tag>

Where <comment> is the initial comment on all imported files and <project name> is the name you will use to access the files in this project.  <vendor tag> and <release tag> be anything.

Setting up work directories

After the repository has been created and initialized, all group members (including the one who created the repository) should create working directories to house the files checked out of the repository.  For each user, set up the environment variables specified in the 'Setting up environment variables' section.  Then, execute the following command from an MS-DOS prompt :

cvs checkout <project name>

Where <project name> is the name of the project specified when creating the repository.  This command will create a directory with the name <project name> and containing all files and subdirectories contained in the project.

Basic Usage

To obtain the latest version of a file, execute :

cvs checkout <filename>

To put a modified file in the repository, execute :

cvs commit -m "<comment>" <filename>

To view the differences between a file in the working directory and the repository, execute :

cvs diff <filename>

To add a new file to the repository, execute :

cvs add <filename>

Note : You must commit the file after adding it before other group members can check it out.

To remove a file from the repository, execute :

cvs remove <filename>

Note : You must commit the file before it is actually removed.

More information

See cvs.html for further information on using CVS.

If there are any questions/comment on this document, please send them to acl@cs.cornell.edu.