views:

53

answers:

5

Ack! I just mistakenly ran "svn revert somefile" with the wrong filename pasted in. Now my nicely modified file is gone!

I'd like a "svn unrevert" command. AFIK there's no such thing. What is the next best way out of this mess?

A: 

An undelete utility.

I like File Scavenger.

It's hit and miss, but you have a chance of getting your file back. The less disk activity since the delete, the greater your chance.

Blank Xavier
Wouldn't work: the file was not deleted, but replaced.
Andrey Breslav
I've found with FS that old versions of the same file persist. NTFS != FAT.
Blank Xavier
A: 

Sorry to say, but that is not possible.

Alan Haggai Alavi
+2  A: 

If you use Eclipse or IDEA they store local history, and you can use it to restore your changes. I don't think there is any other way.

Andrey Breslav
+6  A: 

There's no way to un-do a revert. You can revert because Subversion keeps a copy of the original file inside the .svn folder, and when you run the revert command the backup copy is copied over the file in your working copy. Subversion doesn't back up your modified file before it performs the revert, so unless you made a copy of it somewhere you are probably out of luck.

bta
That being said, if you still have the file open in an editor, you may be able to recover it. Add a space somewhere and save the file, and the copy in the editor's memory (which contains your modifications) should be saved over the copy on the disk.
bta
+1  A: 

It might have preserved the file as it was before the revert under another name, ${FILENAME}.orig or ${FILENAME}~ or some such. If it didn't, sorry, you're out of luck.

Zack
I use kwrite, which saves (filename)~ but I had turned off that feature, annoyed at all the filenamed ending with ~ appearing everywhere. :(
DarenW