CVS Resources

Note that the CVS Resources have moved to http://chess.eecs.berkeley.edu/softdevel/faq/1/

This page is no longer being maintained.

CVS is the Concurrent Version control System, based on RCS.

CVS allows multiple developers to concurrently modify source code packages.

Remote Links

Local Links

Contents The next below this point is out of date and needs work

Common CVS Commands

Below is some text from William Wu about CVS commands
cvs import [module|file]
add files/modules into the repository directory.
cvs commit [module|file]
Check in your modified files/module to the repository, creates a new file that merge your file and the one in repository. Note it is a MERGE not a replace, so it could cause problem. A good rule is to after you modified the file, do a cvs update (see below) first, so you have the newest version, and try to recompile and run, so that you can find any conflict that arise.
cvs update [module|file]
updates your files to the files in the repository, if you have made some change to your files, it will merge the two. This is always a good thing to do before you do commit, since someone else can modify the file and check in after you last update, thus it is possible the changes he made is in conflict with you changes. By doing a update, you can find out about the changes he made and spot any conflict. (conflict is indicated by a letter c in front of file name, in the messages from CVS)
You can run cvs -n update to preview what would happen if you ran cvs update. The -n option does not change any files, it only issues reports.
cvs checkout [module|file]
Use this when you check out the files/module for the first time. When someone had import a new file in, you can use this command to check it out, or I think do a update on the module will also add the new file to you directory.
cvs status [module|file]
Give a status report on the files comparing with the newest version in the repository. The files status can be Up-to-Date, Modified ... Uses this command before commit, then you can check if you need to do a update or not.
cvs diff [module|file]
does a diff with your file and its newest version in repository.
cvs history [module|file]
gives a report on the history of modication done on this file, users, date etc.

These are some commonly used ones, you can always use cvs(1) man page for help.


Common CVS tasks

Checking out just one directory

The old symbolic links method we used with SCCS probably won't work as well. Your best bet is to just check out the entire tree

To check out just one directory outside of your tree, you can use the directory name with cvs checkout

      cvs checkout ptII/ptolemy/plot
      
    
will create the directory ptII/ptolemy/plot in the current directory.

.cvsrc file

Brian Evans suggested that if your ~/.cvsrc file contains the following:
      cvs -z3
      update -d -P
      
    
Then you will get the following features automatically:
cvs -z3
compression when doing a cvs checkout. This can be especially useful when you are dialed in from home
update -d -P
When you do cvs update, create and prune directories as necessary.
The alternative is to use the command line arguments each time you run the appropriate commands.

Administrative CVS Commands

Below are some common scenarios for fixing up the CVS database. See the FAQ for more examples.

Ignoring files

/users/cvs/Repository/CVSROOT/cvsignore contains the patterns for files that are ignored when cvs update is done. If cvsignore includes *.class, then when you do cvs update, you won't see messages like
      ? DEActor.class
      ? DEDirector.class
      
    

Adding a directory

  1. Create the directory
              mkdir foo
              
          
  2. Update the Repository and create foo/CVS
              cvs add foo
              
          
  3. Populate foo with your files
  4. Add the files:
              cd foo
              cvs add file1 file2
              cvs commit
              
          

Deleting a file

  1. (optional) Make sure that you do not have any uncommitted changes to the file:
              cvs update foo.c
              
          
  2. Remove the file:
              rm -f foo.c
              
          
  3. Tell CVS you want to remove the file:
              cvs remove foo.c
              
          
  4. Commit the changes, move the file to the CVS attic directory
              cvs commit foo.c
              
          

Fixing a Binary file</>

This is covered in Chapter 9 of the CVS documentation.

If a file gets added without -kb, then you can fix it with

  1.           cvs admin -kb foo.class
              
          
  2.           cvs update  -A foo.class
              
          
  3. Then copy in a good copy of the file from outside CVS.
  4.           cvs commit -m "Make it binary" foo.class
              
          
cvs remove -f foo.c will remove the file for you.

Renaming a file

The faq says:
      4. How do I rename a file? 
      
      CVS does not offer a way to rename a file in a way that CVS can track
      later. See Section 4B for more information.
      
      Here is the best (to some, the only acceptable) way to get the effect
      of renaming, while preserving the change log:
      
      Copy the RCS (",v") file directly in the Repository.
      
      cp $CVSROOT//,v $CVSROOT//,v
      
      By duplicating the file, you will preserve the change history and the
      ability to retrieve earlier revisions of the old file via the "-r
      " or "-D " options to "checkout" and "update".
      
      Remove the old file using CVS.
      
      cd / rm 
      cvs remove 
      cvs commit 

      This will move the  to the Attic associated with .
      
      Retrieve  and remove all the Tags from it.
      
      By stripping off all the old Tags, "checkout -r" and "update -r" won't
      retrieve revisions Tagged before the renaming.
      
      cd /
      cvs update 
      cvs log                  # Save the list of Tags
      cvs tag -d  
      cvs tag -d  
      . . .

      This technique can be used to rename files within one directory or
      across different directories. You can apply this idea to directories
      too, as long as you apply the above to each file and don't delete the
      old directory.
      
      Of course, you have to change your build system (e.g. Makefile) in
      your  to know about the name change.
      
      Warning: Stripping the old tags from the copied file will allow "-r
      " to do the right thing, but you will still have problems with
      "-D " because there is no place to store the "deletion time".
      See 5B.3 for more details.
      
      Last modified: _6/13/1997_
      
      
    

Binary Files

See Fixing a Binary file above.

Using cvswrappers might be useful


EDITOR Variable

When CVS needs a log message, it reads the EDITOR environment variable to determine which editor to startup. If you set EDITOR to emacs, then each time CVS needs a log message it will start up an emacs. If you always have an emacs process running. Consider using emacsclient instead.
  1. Edit your ~/.emacs file and add
              (server-start)
              
    	
    to it
  2. Edit your ~/.cshrc file and add
              setenv EDITOR emacsclient
              
          
Now, when you CVS needs a log message, it will bring up a window in your emacs process. When you are done editing, type C-x #

For more information about emacsclient, start up emacs and type M-x info and search for the emacs online documentation.


Local Installation

The local installation is in /usr/eesww/gnu/cvs

Installing

  1. configure --prefix=/usr/eesww/share/gnu/cvs-1.10.3 --exec-prefix=/usr/eesww/gnu/cvs-1.10.3 --enable-encryption
  2. Edit config.h and change
              /* #undef HAVE_KERBEROS */
              
    	
    to
              #define HAVE_KERBEROS 1
              
          
  3. Edit src/Makefile, and add the following to the INCLUDES line
              -I/usr/kerberos/include/kerberosIV -I/usr/kerberos/include
              
          
  4. Edit Makefile, and add the following to LIBS
              -L/usr/kerberos/lib -lkrb -ldes -lcompat
              
          
  5. Compilation failed because flock was undefined
              Undefined                   first referenced
              symbol                          in file
              flock                               /usr/kerberos/lib/libkrb.a(tf_util.o)
              
    	
    The fix was to edit Makefile and add -lcompat after -lkrb
  6. Create directories:
              mkdir /usr/eesww/share/gnu/cvs-1.10.3
              mkdir /usr/eesww/share/gnu/cvs-1.10.3/info
              mkdir /usr/eesww/gnu/cvs-1.10.3
              mkdir /usr/eesww/gnu/cvs-1.10.3/bin
              mkdir /usr/eesww/share/gnu/cvs-1.10.3/man
              mkdir /usr/eesww/share/gnu/cvs-1.10.3/man/man1
              mkdir /usr/eesww/share/gnu/cvs-1.10.3/man/man5
              mkdir /usr/eesww/share/gnu/cvs-1.10.3/man/man8
              make install
              
          
  7. /usr/eesww/share/gnu/cvs-1.10.3/doc contains .ps and .pdf documentation files that were placed there by hand.

Last Updated: $Date$