Getting the last version of a deleted folder in subversion
Asked Answered
N

2

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.

Nibbs answered 19/1, 2012 at 8:4 Comment(3)
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.Contingency
@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.Nibbs
@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.Nibbs
C
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.

Contingency answered 19/1, 2012 at 8:20 Comment(1)
Just one note: svn log -q -v will be slightly nicerFirstclass
T
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

Takashi answered 19/1, 2012 at 8:19 Comment(1)
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.Nibbs

© 2022 - 2024 — McMap. All rights reserved.