*banner
 

Software Development
FAQ
CVS
Previous section  |  This section  |  Next section
Previous question  |  This question  |  Next question

Adminstrative CVS Commands
Christopher Brooks, 10 Aug 2012
Last updated: 10 Aug 2012

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. Tell CVS you want to remove the file:
    cvs delete -f foo.c
    
    The -f option forces cvs to delete the file from the current directory.
  3. 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.
Previous section  |  This section  |  Next section
Previous question  |  This question  |  Next question
©2002-2018 Chess