Go to the previous, next section.

Moving and renaming files

One of the biggest design flaws with the current release of CVS is that it is very difficult to move a file to a different directory or rename it. There are workarounds, and they all have their strong and weak points. (Moving or renaming a directory is even harder. See section Moving and renaming directories).

The examples below assume that the file old is renamed to new. Both files reside in the same module, module, but not necessarily in the same directory. The relative path to the module inside the repository is assumed to be module.

Moving outside the repository

One way to move the file is to copy old to new, and then issue the normal CVS commands to remove old from the repository, and add new to it. (Both old and new could contain relative paths inside the module).

$ mv old new
$ cvs remove old
$ cvs add new 
$ cvs commit -m "Renamed old to new" old new

Advantages:

Disadvantages:

Moving the history file

This method is more dangerous, since it involves moving files inside the repository. Read this entire section before trying it out!

$ cd $CVSROOT/module
$ mv old,v new,v

Advantages:

Disadvantages:

Copying the history file

This is probably the best way to do the renaming. It is safe, but not without drawbacks.

# Copy the RCS file inside the repository
$ cd $CVSROOT/module
$ cp old,v new,v
# Remove the old file
$ cd ~/module
$ rm old
$ cvs remove old
$ cvs commit old
# Remove all tags from new
$ cvs update new
$ cvs log new             # Remember the tag names
$ cvs tag -d tag1
$ cvs tag -d tag2
...

By removing the tags you will be able to check out old revisions of the module.

Advantages:

Disadvantages:

Go to the previous, next section.