15

I need to get the content of folder deleted from our repository long time ago

  • I still know the name of the folder
  • I don't know the revision in which it was deleted
  • I don't know the date when it was deleted
  • In the history of the parent directory there is no information (i.e., there is not comment mentioning that the folder is deleted)

svn log doesn't seem to help:

$ svn log deleted_folder
svn: 'deleted_folder' is not under version control

svn co also doesn't help

$ svn co URL/deleted_folder

How can I find out the last revision of the deleted folder?

EDIT: an option would be with brute force to check backwards for every revision but as there are more than 10K of them the option would be just for emergency. And I really feel that there definitely must be a better way.

Matteo
  • 14,696
  • 9
  • 68
  • 106
  • I'm not sure if this will work, but try going to the parent directory of the deleted directory, and do `svn log -v . | grep deleted_folder` and see if that'll help you find the revision that it was deleted in. – Michael Burr Jan 19 '12 at 08:14
  • 1
    @MichaelBurr Thanks it was as simple as that. Actually you need something more since grep will give you just that line but I can redirect the output to a file and then look back which was the revision. Post it as an answer so that I can accept it. – Matteo Jan 19 '12 at 08:15
  • @MichaelBurr It is also necessary to check out the parent folder of the given revision: `svn co -rREVISION .../parent/deleted_folder` will not work. `svn co -rREVISION .../parent` works. I'll check out a lot of unnecessary stuff but it works. – Matteo Jan 19 '12 at 08:20

2 Answers2

13

You can find the revision that the directory was deleted in by going to the parent directory of the deleted directory and using the following command:

 svn log -v . > somefile

then search somefile in an editor for the revision record contain the delete for the directory name.

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
6

You may find the revision using:

svn log -v | grep "D /deleted_folder" -C 5

Then you should copy the revision to current according to answer of this question:

examining history of deleted file

Community
  • 1
  • 1
Jason
  • 807
  • 5
  • 15
  • Thanks, -C 5 could not be sufficient but I can always store the result of the `svn log` to a file and then look for the revision manually. – Matteo Jan 19 '12 at 08:25