[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to rename a file in CVS

From: Stephen Gildea
Subject: How to rename a file in CVS
Date: Fri, 13 Oct 2000 18:25:38 EDT

For use locally, we figured out and wrote up how to rename a file in
CVS.  Our procedure is a variation of the "Copying the History File"
method described in section 7.4.3 of the CVS 1.10 manual.  Because I
like our presentation and the details about log messages and branch
tags, I thought I'd share it with you for addition to the CVS manual.
(Really, this ought to be built in to CVS.)

This procedure modifies the CVS repository without going through CVS
commands and is therefore dangerous.  Please be sure you understand it
before you start.  If you are at all unsure, have a CVS guru look over
your shoulder.

1.  Copy the history file in the repository.
cd $CVSROOT/...
cp -p old,v new,v

2.  Remove the old file.
cd my-sandbox/olddir
rm old
cvs remove old
cvs ci -m "file renamed: moved to new" old
("new" should be the pathname relative to the top of the sandbox)

3.  Make the new file appear.
cd newdir
cvs update new

4.  Remove all the release tags from the new name.
    These are listed under "symbolic names" by the "cvs log" command.
cvs log new             (to get a list of the tags)
cvs tag -d tagname new  (repeat as necessary)

If you are doing the rename on a branch, do *not* remove the tag for
   that branch name.

If you are renaming a lot of files, you can use a command like like:
# Just an example!  Be careful with this!  Don't lose your branch tag!
# cvs tag -d `cvs log somefile | head -9 | tail -1` lots-of-files.*.c

5.  Note the move on the new file.
cvs ci -f -m "file renamed: moved here from old" new
("old" should be the pathname relative to the top of the sandbox)

It is important that the comment on both checkin (commit) commands
start with ``file renamed'' so they can be found later if necessary.
The rest of the comment is free-form.

The object of this complicated procedure is to keep the version
numbering consistent, provide the entire history under the new name,
allow checking out sandboxes under old tags, and record the rename.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]