Software Design (CS223 2004F)

Using CVS in CS223

In CSC223, we will use CVS (the concurrent versioning system) for sharing files in projects. This document is intended to give you a quick introduction to using CVS in CS223. There are many other potential references on CVS, most of which you can find with a smart google search (or by starting at ). This document gives you some guidance in

Getting Started

In CVS you need a central CVS repository in which the shared files are stored. For CS223 Labs, you can find the repository in /home/rebelsky/Web/Courses/CS223/2004F/cvsroot. Once you've checked out a project, CVS should remember where the original repository is.

You can check out a project with

cvs -d dir checkout files-or-directories
For example,
cvs -d /home/rebelsky/Web/Courses/CS223/2004F/cvsroot checkout Test
will check out the test directory (used for this document).

If you get sick of typing the -d dir, you can add the following line to your .bashrc or type it at the command line:

export CVSROOT=/home/rebelsky/Web/Courses/CS223/2004F/cvsroot

Working with a Checked Out Project

Once you have checked out a project, you can feel free to modify the files in the project, to add new files, and to make a note of files you'd like to delete. When you've made a working change to the project, you need to insert your changes into the shared repository.

If you've added a new file to the project, you should tell CVS about it with

cvs add file
If you're following along, you might want to work in the Test project and create a file with your name. You can then add it. I used
cvs add samr
Note that this does not immediately add the file to the central repository. Rather, it schedules the file for addition.

If you've noted that a file needs to be removed, you can use

cvs remove file
Again, this does not immediately remove the file, but schedules the file for "removal". (It is never completely removed in case you later decide you need it.)

When you've made all your changes, you can use

cvs commit
This will then ask you to enter comments about the changes you've made. These comments might help your colleagues as they make subsequent changes.

If you only want to commit changes to one file, you can use

cvs commit filename

Collaborative Updates

You've made changes to some files in a project. Your colleagues may also have made changes. How do you know? You can ask CVS to tell you about the differences between your files and the committed changes with

cvs diff
You can ask CVS to load the newest versions with
cvs update

Warning! When you update a file you've modified and someone else has modified, CVS will try to merge in the differences. However, it doesn't always succeed. If it fails, it leaves some evidence in the file that you must fix before committing your changes.

Adding a New Project

When you want to add a new project to the CS223 repository (and not just a few files to an existing project), you need to use a special command that's a little more complicated than I'd like. Please add new projects with caution. In many cases, it makes sense to extend an existing project.

First, switch to the directory that contains the project files.

Next, issue the following command

cvs -d cvs-directory import -m comment directory cs223 start

For example, to create the Test project, I used

cvs -d /home/rebelsky/Web/Courses/CS223/2004F/cvsroot import -m "For Playing with CVS" Test cs223 start

Creating Your Own Repository

I hope that you'll evetually want to use CVS for something other than just your work for CS223. In that case, you should probably create your own repository. You can do so with

cvs -d directory init

I believe that by default, cvs gives access to anyone in the Unix group associated with that directory. You can change the group associated with that directory with

chgrp -R group directory

For example, I created the CS223 CVS directory with

cvs -d /home/rebelsky/Web/Courses/CS223/200FF/cvsroot init

If there were a cs223 group (there's not), I'd then use

chgrp -R cs223 /home/rebelsky/Web/Courses/CS223/200FF/cvsroot 

Since there's not a cs223 group, I used the hack of

chmod -R a+rwx  /home/rebelsky/Web/Courses/CS223/200FF/cvsroot

Instead of creating your own repository, you might also consider using the MathLAN CVS server. Chat with Mr. Stone about this option.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue Dec 7 21:49:29 2004.
The source to the document was last modified on Mon Sep 20 08:37:27 2004.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky,