Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undelete a file with Subversive?

Please note: This is a question about the Eclipse plugin Subversive, and not about Subversion itself. Please do not change the title to be about 'Subversion'.

So I deleted a file that I really shouldn't have.

I've found various approaches to restoring the file outside of Eclipse/Subversive, but I was wondering if there was a best/easiest-to-use/history-restoring way to restore the file using the Subversive tool.

like image 698
Brian Laframboise Avatar asked Jan 30 '09 21:01

Brian Laframboise


3 Answers

  1. Select the folder in the project that contained the deleted files.
  2. Right click, select Team > Merge...
  3. On the URL tab, set the URL to the server URL for the same folder.
  4. In Revisions, select Revisions and enter a range that includes the deletion, e.g. 1000-1001, or use the Browse button to select them.
  5. In Revisions, enable Reversed merge
  6. Click Preview and check that it shows an Added entry for the files you plan to restore.
  7. Click OK - Eclipse switches to SVN Merge in the Synchronize view.
  8. In the Synchronize view, right click the files you want and select Accept
  9. In the Synchronize view, use the Synchronize SVN icon to switch from SVN Merge to SVN, where you can see the restored file as an outgoing change.
like image 89
Peter Hilton Avatar answered Oct 23 '22 15:10

Peter Hilton


If you have already submitted the remove then it's now time to roll back to the earlier version. In Subversion you do that with "svn merge", where you merge "backwards" from the current to the previous version.

Say you did this:

$ svn rm file.txt
$ svn ci -m "don't need that file"
Committed revision 1325.

Now you want to undo this and restore the old revision 1324, i.e. the state just before the remove (the dot is for 'current directory'):

$ svn merge -r1325:1324 .

If you are unsure you can do a dry-run first, where svn will print the output of the command, but not actually do anything:

$ svn --dry-run merge -r1325:1324 .

The result should indicate that the file is being added (again):

A file.txt
like image 4
Frank Avatar answered Oct 23 '22 13:10

Frank


you could switch to revision where this file was exist. Edit/copy this file and switch back to the head revison and commit it here.

Also you could merge changes beetween two revisons - head and last revision file was exist in repository and apply changes to your working copy.

like image 2
waney Avatar answered Oct 23 '22 14:10

waney