Tortoise CVS Move hack

CVS doesn’t support moving files within a repository. (Great program, but didn’t get architected so well, eh? Programmers will want to move project files around in the future? Never happen!)

As you may know, a CVS ‘move’ means you have to Remove the directory structure and then Add it to the new place. (Deleting your history in the process.)

If you are using Tortoise CVS and you move a huge directory structure over, you may experience the hell of having 100’s of conflicting ‘hidden’ CVS directories throwing errors when you try to add the structure. You can write a script to remove them recursively or remove them by hand, but here’s a simpler hack for windows.

 (Always make a fresh backup before removing or moving lots of files in CVS!)
1. Run the Tortoise Remove command on your directory structure that you want to move. Commit the ‘remove’.
2. In Windows Explorer, move the leftover directory structure to someplace outside of the overal CVS directory hierarchy. This removes all the old hidden CVS directories that were left behind.
3.  Go to Windows Recycle Bin, and you will see all the
files that you removed from CVS using Tortoise. Order these by data deleted. Highlight them all and click ‘Restore’. This moves all those files and folders back into their old structure, but minus the hidden CVS directories.
4. In Windows explorer, copy your new ‘clean’ diretory structure to the desired location. Now click ‘Add Contents’ in Tortoise CVS from the top of that structure. Then click ‘Commit’.

5. You can now delete the old set of hidden CVS folders.

6. Always confirm your ‘Move’ by making a brand new download of the CVS repository, and building the app.

Final Thoughts:

– I think it would be great to build this functionality into Tortoise.
– Use Subversion instead of CVS every time you can. Subversion supports moves natively, is faster, uses less bandwidth, etc.

This entry was posted in Tips. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *