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. This page describes the basic commands that you need to know to start using cvs.
Essentially, your changes to the source code are only distributed to other users when you explicitly commit your code using the "cvs commit" command. Changes made by other users are only seen by you when you explicitly request them 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.
Availability
The CVS executable is available on the CSUGLab machines. In Windows just open a cygwin window and type "
cvs
". On the CSUGLab Linux hosts (csug01, ..., csug06), you'll find it in/usr/bin/cvs
. This page gives information about how to request a cvs repository in the CSUGLab, and then gives a quick overview of the main cvs commands. Once you have set up your cvs repository, we encourage you to use the Eclipse development environment available on the CSUGLab machines. Eclipse has a user-friendly interface to cvs, making it easier to use than from the command line.
CVS Repository
CVS repositories are available to students with CS Undergraduate Lab (CSUGLab) accounts for use in a course or project. The main repository is set up on a host named cvs.csuglab.cornell.edu in the
/cvsroot
directory. To request such a repository, please submit a ticket to the Helpdesk or send an e-mail tocsuglab-admin@cs.cornell.edu
.You can access the repository either locally or remotely:
Local access: log on to cvs.csuglab.cornell.edu and run cvs command using:
cvs -d :local:/cvsroot
Remote access: set your CVS_RSH environment variable to "
ssh
" and then run cvs commands using
cvs -d :ext:<your_userid>@cvs.csuglab.cornell.edu:/cvsroot
You can avoid using the "-d" argument to the
cvs
command by setting the environment variable CVSROOT to the appropriate value (:local:/cvsroot
or:ext:<your_userid>@cvs.csuglab.cornell.edu:/cvsroot
). Note: you can find this information on the CSUGLab CVS usage page.In the following sections, we give a quick summary of the most common cvs commands. We assume that your CVSROOT has been set appropriately, either for local or for remote access. Alternatively, you can run the cvs commands presented below using the explicit "-d" option as the first argument.
Note for Windows users: to set up environment variables in Windows, right click on the My Computer icon and choose Properties. Select the tab labeled Environment. On win2000, go to control panel > system > advanced tab > environment variables. Under cygwin, you can set environment variables in your
.bashrc
file usingsentenv
.
Initializing a repository
You can create a directory for storing your file repositories by 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. The arguments<vendor tag>
and<release tag>
be anything, but must be present.
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 a shell prompt (cygwin or a unix shell):
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 the on-line documentation for further information on using CVS.