CVS Information page

CVS is a configuration management tool. It allows a group of people to work on a set of source files and it tracks changes to those files over time. A thorough introduction to it can be found here:

CVS book ps or pdf

The official homepage for it can be found here

Some other links:
http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/
http://www.loria.fr/~molli/cvs-index.html
http://www.geocities.com/vivekv/cvs-bestpractices/index-cvs-bestpractices.html

Local Server

The local server for the class is: skyhawk.cs.uah.edu:/local/cvs

cvs -d /local/cvs login
if you are already logged into machine skyhawk.

The main commands are:
command action
login Identify yourself to the cvs server
commit Save all the changes that you have made in this directory and in subdirectories
update Get changes that others have submitted
add add a file to the set of files you are versioning.
import This command is what you use to get started. It creates a new project that you will later checkout
checkout Use this command to get a new copy from the server of all of the files. This should be used immediately after you do an import.

Example rsh use:

Set your environment variable CVS_RSH to point to a local copy of ssh, for example in bash you would type
export CVS_RSH=/usr/bin/ssh
or in tcsh
setenv CVS_RSH /usr/bin/ssh
Then you can use a command like
cvs -d :ext:name@skyhawk.cs.uah.edu:/local/cvs update
or some other command. The :ext: tells cvs that you are accessing a remote system.

Example tunnel use:

(This method is currently disabled for skyhawk.)

  1. First log into the skyhawk (you can skip this if you are on skyhawk).

    ssh -g -L2401:skyhawk.cs.uah.edu:2401 name@skyhawk.cs.uah.edu

  2. cvs does not have a good password protection mechanism, so if you are working remotely you can use ssh to set up a tunnel that will allow you to log in and protect your password. Logging into the cvs directory happens next:

    cvs -d:pserver:name@localhost:/local/cvs login

    Note, this is in a seperate window from the one that you logged into skyhawk with. You use localhost here because ssh is forwarding requests from the local machine to skyhawk (remember this is what provides the password protection).
  3. Now it is time to put whatever you have onto the server.

    cd srcdir
    cvs -d:pserver:name@localhost:/local/cvs import name_cs687 name cs687

    This will take the contents of whatever is in srcdir and its subdirectories and add it to the cvs repository as the project name_cs687. You should only have src files in the directory when you check it in. Having binaries in the repository will be messy and will greatly degrade performance, especially if you are working remotely.
  4. Now that the src has been checked in, you need to check it out.

    cd ..
    mv srcdir old_srcdir
    cvs -d:pserver:name@localhost:/local/cvs checkout name_cs687

    You are ready to go now.
  5. Let's try adding and editing.

    cd name_cs687
    edit filea
    create fileb
    cvs add fileb
    cvs commit

    Here edit and create are whatever you use to create and edit files. When you perform the cvs commit it will ask you for some comments and then add the new versions of the files to the repository. Notice you no longer need the -d flag, that is because cvs caches it for you.

Clients

There are many clients, here are a few to get started. You can also find a copy of the cvs client on the cs departments sun machines at /home/home2/csuser/dhart/pub/sunbin/cvs

In windows jCVS has been installed on the department machines.

Branches

Branching is useful to allow a group of developers to share code that should not be released yet.
  1. If you do not already have a working repository get one with checkout.
  2. Then run
     cvs tag -b monthyear-branch-name 
    in the top directory of the working copy.
  3. Then run
     cvs update -r monthyear-branch-name 
    .
Now you are all set to work on the branch and share it. For another developer to checkout the code use:
 cvs checkout -r monthyear-branch-name module 
. Later when it is time to merge the branch back:
  1. First commit any remaining changes to the branch, cvs commit.
  2. Then revert to the main branch,
     cvs update -d -A 
    .
  3. Now the merge,
     cvs update -d -j monthyear-branch-name 
    .
  4. Resolve any conflicts, perform tests and other qa, and then commit