Dr D's Abode


Renaming files in CVS – and keeping the history

by on May.31, 2009, under Code, Computers, CVS, Linux

So I am working on a personal project, and decided to rename the file.  Now, I know from experiance that you cannot rename a file in cvs, and keep its commit history, but I decided to see if someone found a way.  Well, someone did, partially… http://www.eyrie.org/~eagle/notes/cvs/renaming-files.html

He shows the way I used to do it, mv local file, cvs delete old file, cvs add new file, commit changes. – This deletes the cvs commit history

He also mentions about modifying the raw RCS file and renaming that, but apparently, cvs doesnt like that since cvs itself isnt aware of any changes.

So I tried a mixture of them, heres my process:

  • Find the raw RCS file:  cat CVS/Root CVS/Repository – in my case, /cvs/projects
  • Copy that file somewhere: cp /cvs/projects/currentfile.sh,v /tmp
  • Rename the file in the current checked out sources:  mv currentfile.sh newfile.sh
  • Delete, Re-add, and commit changes: cvs delete currentfile.sh; cvs add newfile.sh; cvs commit currentfile.sh newfile.sh
  • Move the Attic’ed file from cvs: mv /cvs/projects/Attic/currentfile.sh,v /tmp/ currentfikle.sh,v-Attic
  • Copy the old RCS file to the new name: cp /tmp/currentfile.sh,v /cvs/projects/newfile.sh,v
  • Re-cvs up: cvs up

Now you have a renamed file in CVS, that CVS is aware of, and keeping your old history!

Please comment if you find this helpful or if you have any other information to add!

1 Comment :, , , more...

Geek Code

Version: 3.1
GIT d-(+) s:+ a C++ BL++++ P++>+++ L++(+++) E--- W++ N o K- w O M V-- PS
PE Y+ PGP+ t+ 5 X+ R tv b DI D+ G e+ h+ r-- y+

Linux Counter



PSN Portable ID

Powered by

Powered by Gentoo Linux