views:

990

answers:

3

Whoops, I need some info from a file I deleted, a while ago. In CVS I would just go to the ATTIC to find it, how do I find a file in SVN without having to go back to a revision where it existed (especially annoying since I have no idea really when I deleted -- one week ago, two weeks ago...)

+3  A: 

Browse the SVN Log of the directory it was in, find the revision where you deleted it. In the bottom pane, right click the file, and choose the option "Save Revision To..".

To help you find which revision you deleted it in, look for the icon of a doc with an X in the lower left of it in the Actions column of Show Log.

Tom Ritter
What client UI are you talking about here?
nathan
tortoiseSVN. I went off his tag.
Tom Ritter
Ah. Didn't notice the tag. Thanks.
nathan
+1  A: 

The "attic" in CVS is more of an implementation detail. The file can't be deleted completely from the repository, since the file history is in the ",v" file itself, so CVS moves it aside.

Subversion uses a more sophisticated repository storage mechanism where files don't need to be moved aside in this way. I don't think there's an easy way to query for the most recent revision where a file existed, but you should be able to find it easily enough using "svn ls -r*rev*". In this case rev can be any one of the thing Subversion accepts to indicate a revision - a number, a date, etc. Just go back in history until you find it, then step forward until you find the last revision where it existed.

Update: @AviewAnew has a good idea about checking the log of the directory where the file existed. Since a file delete is really a change to the directory that contains it, it should be easy to find where the file disappeared this way.

Greg Hewgill
+1  A: 
svn log --verbose

will show you what you deleted. Then you can do an

svn copy --revision <last_revision_with_deleted_file>

to get a working copy of the deleted file. This shouldn't be any harder than getting a deleted file from CVS.

David Nehme