Networked Games -- CVS

  • Jian Huang
  • Networked Games
  • The Notes Page

    CVS Quick How-To

    Here is a quick guide to working with CVS.

    Before working with CVS, the CVSROOT environment variable must be set to the corresponding CVS directory. The directory is /research/cs594ng-cvs.

    For csh:

    setenv CVSROOT /research/cs594ng-cvs

    For sh and bash:

    export CVSROOT=/research/cs594ng-cvs

    Add this line to your dot shell file if you never want to type it again.


    List of common commands

    See below for examples and more information on these.

         cvs checkout [module] 
              Stores a private copy of the  moduleÕs source files in your current directory.  
              The visual recipes module name is 'VR'. 
         cvs update 
              Indicates the current status of files in your current private directory of module files. 
         cvs commit [file1] …
              Stores changes of files in your private copy to repository. 
         cvs add [file1] …
              Enrolls files into the cvs records of your current directory. 
              Run cvs commit [files] to add these to the repository. 
         cvs remove [file1] …
              Use this command on files you wish to remove from the repository. 
             Change will not take place until cvs commit. 
         cvs annotate [file1] …
               Prints out the lines for each file. In front of each line is the user who 
               last modified the line plus the revision number and date for the modification.
    

    More details: Before beginning, change to a directory in your home folder where you wish to store the files. Please note that all CVS commands come in this form:

         cvs [command] [arguments]

    To get the current files from CVS, do

         cvs checkout [module], assuming this package is called VR.
    UNIX> cvs checkout VR
    U VR/TODO
    cvs checkout: Updating VR/LIBS
    …
    U VR/VR/VRU/SPACECURVE/zcurve.c
    U VR/VR/VRU/SPACECURVE/zcurve.h
    

    You now have a private copy of the VR module in: [current_dir]/VR.

    The "U" means cvs has updated this file. You may now edit these files as you please and later commit them to the cvs. After you are finished editting a file, you will need to run an update command to see if the file has been changed in the repository. For example, say I edited the vru.h file and wanted to commit the changes. First, I run "cvs update" in the VRU dir.

    UNIX> cvs update
    cvs update: Updating .
    M vru.h
    

    The "M" means the file has only been modifed by me and is safe to commit. For details on the "U A R M C ?" file status indicators, just refer to that portion of the CVS man page using:

    man cvs

    Now it is time to commit the changes into the repository. Be sure you are in the directory with the altered file, and run "cvs commit [file]". Example:

    UNIX> cvs commit vru.h

    CVS will respond that the file is checked in and out new revision number. A log file will appear for you to enter comments about the changes.

    To add files from your private directory to the CVS repository, place the files in the appropriate directory and run "cvs add [files]". This will store the files in your CVS records, and will not be added the the repository until "cvs commit [files]" is run.

    To remove files, to the same as add, except run "cvs remove [files]". Once again, "cvs commit [files]" must be run for change to take affect.


    Important Notes

    The above is how one would normally use CVS. We have a number of different teams using the same repository. For each project, you need to have both a "groupname" and a "projectname".

    Do the following:

       1) export CVSROOT=/research/cs594ng-cvs         // the same
       2) create initial source directory and files    // the same
       3) cd to source directory                       // the same
       4) cvs import groupname cs594ng projectname     // different
    

    Assuming the groupname is "theZenster" and the projectname is "mermaidhunter", the last line becomes:

       cvs import theZenster cs594ng mermaidhunter
    

    This incorporates the source hierachy into CVS. To check out a working directory of the code, you can do:

       cvs checkout theZenster
    

    After you make changes, you can send changes back to the repository with "cvs commit" and "cvs update" in the same fashion.

    For those of you who really need to know everything, in this above description we were using:

    Unless you do something complicated with branching (e.g. making multiple versions of release of your project), neither the vendor tag nor the release tag will ever be used after the initial import command. However, the three must all be different.

    If you need to check out different versions of the code (e.g. your current code is 1.5 but you really want to take a look at 1.4), you can do:

       cvs checkout theZenster -r 1.4