Once a directory has been removed using cvs remove <dir>
and cvs commit
, is there an easy way to undo the change - to restore the directory in my working copy and in the repository? So far I've only been able to find suggestions which would help if I hadn't done the commit yet, or if it were a file instead of a directory. If possible, I'd like to preserve the history of the directory's contents.
The CVS plug-in provides a tool to help restore a file to your workspace that has previously been deleted from the CVS repository: Select a folder managed by CVS and from the context menu select Team > Restore from Repository. The repository will be searched for deleted files and the list will be shown in a dialog.
Right-click the file or folder, and then select Restore previous versions. You'll see a list of available previous versions of the file or folder. The list will include files saved on a backup (if you're using Windows Backup to back up your files) as well as restore points, if both types are available.
Here is the way I do it: Clone the remote repo to some place on your local HD different from where you have your existing local repo. Copy the deleted files/directories from the newly cloned repo to the existing local repo. Commit the changes to your existing local repo, if needed push also to the remote repo.
The way that you remove a directory is to remove all the files in it. You don't remove the directory itself; there is no way to do that. Instead you specify the ' -P ' option to cvs update or cvs checkout , which will cause CVS to remove empty directories from working directories.
(Answering my own question as I figured it out.)
To restore a deleted directory after the delete has been committed:
cvs update -d -R -j <rev2> -j <rev1> <dir>
Where:
<rev2>
is the revision which resulted from committing the remove.
<rev1>
is the revision immediately before rev2.
<dir>
is the deleted directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With