UCSD Main WebsiteUCSD Jacobs SchoolDepartment of Computer Science and Engineering
spacer gif
spacer gif
CSE 120
spacer gifspacer gif
spacer gif
spacer gifCourse Overview
spacer gifspacer gifStructure
spacer gifspacer gifGrading
spacer gifspacer gifCollaboration
spacer gifspacer gifUseful books
spacer gif
spacer gifspacer gifSchedule
spacer gif
spacer gifProjects
spacer gif
spacer gif Homeworks
spacer gif
spacer gifWebBoard
spacer gif
spacer gif
spacer gif
Search
spacer gifspacer gifspacer gif
Advanced search  arrows gif

spacer gif
spacer gifspacer gif
spacer gif
spacer gif
spacer gif

spacer gif

spacer gif
spacer gifspacer gifspacer gif
spacer gif

Using CVS for CSE120

CVS is a version control system available on Unix. Items that are managed by CVS are stored in CVS repositories. A CVS repository contains a collection of files each of which is stored in a format that allows any previous version of that file to be extracted. It does this by maintaining a listing of the first version of your document in its entirety. Each time that you update the CVS file, it determines what has changed and adds a list of the changes to the file. In this way, multiple versions of a file are stored much more compactly than if each version was stored in its entirety.

Before you can use CVS you must create a repository and configure your enviroment variables to point to the correct repository for your group.

  1. Identifying your CVS Repository

    To use CVS, you need to tell it where CVS repository that you are using exist. In our case the CVS repository are in /home/solaris/ieng9/cs120f/public/cvs/groupXX, where XX ranges from 1-30, and is your group number, as found here.

    % setenv CVSROOT /home/solaris/ieng9/cs120f/public/cvs/groupXX

    or if you are using bash

    % export CVSROOT=/home/solaris/ieng9/cs120f/public/cvs/groupXX
  2. Create a CVS Repository

    Note: This step should be performed by only one member in your group!

    You need to create a CVS repository.

    % cvs init
  3. Create a CVS Module

    Note: This step should be performed by only one member of your group!

    We are going to create a CVS project by importing your nachos directory. Before importing the module we should clean your nachos directory.

    % cd ~/nachos-3.4/code
    % gmake clean

    Next, we use the cvs import command identifying the module name to use within CVS. The import command also requires two tags (vendor and release) but they are not important in our case.

    % cd ~/nachos-3.4
    % cvs import nachos-3.4 cs120 fa05
  4. Working from CVS

    Before you can start making changes to your CVS module you need to check out a copy of the module. Note: If you already have a directory named nachos-3.4 with the source code, it won't work, because it doesn't have the CVS information, in which case it'd be best to move that to another directory and start fresh with your CVS copy.

    % cd ~
    % cvs checkout nachos-3.4

Additional Commands

Here is a list of other commands that you might find useful when working on your projects.
  • Saving Modified Files in the Repository

    To save the current version of your files in the repository, you commit your changes. It will find any files that have changed, and will let you give a message indicating what you did. Each version of the file will be saved, and can be retrieved if needed. Note: You may get an error saying that the up-to-date check failed, in which case you should update before committing (see below).

    % cvs commit
  • Updating Files from the Repository

    To update to current version of your files to the latest version in the repository, you need to use the update command. Update will merge in changes if your partners and you have both changed the same files, this usually is okay, but if there is a problem, you will have to edit it manually, as it will put strange messages in your code that cause it to not compile anymore.

    % cvs update -A
  • Tagging Files in the Repository

    You can label the current code by using the rtag command and specifying a tag in the command line. You can then use this tag to keep track of older versions of the code. This is mostly useful for labeling the code when you are done as the turned in code.

    % cd ~/nachos-3.4/code
    % cvs rtag -F [label] [files]
  • Adding Files in the Repository

    Files can be added to the repository by using the add command and specifying the name of the file. Note: You must commit the changes by using the commit command after adding files.

    % cvs add [file]
  • Removing Files from the Repository

    Files can be deleted from the repository by using the remove command and specifying the name of the file. Note: You must also remove the file from the local file system. You probably should remove binaries from the repository, as CVS doesn't work very well with binaries.

    % cvs remove [file]

There are many more commands, but these should get you started. CVS's builtin help is very informative about any other commands you may be interested in.

% cvs --help
% cvs --help-commands
% cvs -H [command]
spacer gif
spacer gif
spacer gif
spacer gif
9500 Gilman Drive, La Jolla, CA 92093-0114
spacer gif
About CSE | CSE People | Faculty & Research | Graduate Education | Undergraduate Education
Department Administration | Contact CSE | Help | Search | Site map | Home
snoeren@cs.ucsd.edu
Official web page of the University of California, San Diego
Copyright © 2002 Regents of the University of California. All rights reserved.
spacer gif