Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I restore a directory deleted from CVS after committing the change?

Tags:

cvs

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.

like image 231
bythescruff Avatar asked May 14 '12 10:05

bythescruff


People also ask

How do I recover deleted files from CVS?

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.

How do I undo a folder I accidentally deleted?

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.

How do I restore a repository file?

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.

How do I delete a folder in CVS?

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.


1 Answers

(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.

like image 81
bythescruff Avatar answered Oct 31 '22 18:10

bythescruff