Moving Files in CVS Without Loosing History

Whenever you move files around in CVS, you loose the history associated with that file. People tend to get upset about this; though, on the projects I’ve worked on, we’ve moved stuff around every release, loosing history, and it’s never killed us. No one really raised a peep. For the most part, people just want to use it when they’re in that “what fucking idiot put wrote this bug!” mode at 3AM in the morning…

Nonetheless! Thanks to a recommendation from The JC, I found this helpful tidbit in Open Source Development with CVS:

I Need to Move Files around without Losing Revision History.

In the repository, copy (don’t move) the RCS files to the desired new location in the project.
They must remain in their old locations as well.

Then, in a working copy, do:

yarkon$ rm oldfile1 oldfile2 ...
yarkon$ cvs remove oldfile1 oldfile2 ...
yarkon$ cvs commit -m "removed from here" oldfile1 oldfile2 ...

When people do updates after that, CVS correctly removes the old files and brings the new
files into the working copies just as though they had been added to the repository in the usual
way (except that they’ll be at unusually high revision numbers for supposedly new files).

So, there you have it: one of the big “CVS sucks!” bullet points resolved. I’ll see how easy that is to actually do. Anyone else ever do this?

(And yes, I know this would be easier in subversion. You know who you are!)

Leave a comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.