Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recover a SVN repository from ONLY the db folder?

Tags:

recovery

svn

I have a project from a year ago from which I would like to recover source code. The SVN repository of that project has ONLY the db folder; however, the db folder seems to be complete, including all the files from the db/revs folder. I have no backup of this SVN repository, and I have no idea what happened to all the other files which should be there.

Unsurprisingly I am unable to recover the working copy from this repository. I have tried to copy in the essential database structure from a working repository, and I have tried to use svnadmin recover, and I cannot get any data out of it.

Is it possible to retrieve at least the last working copy from the db? I would be okay starting a new SVN from that point.

Thank you!

like image 576
Pops Avatar asked Mar 22 '23 18:03

Pops


1 Answers

There really isn't much that you need outside of the db directory.

This is what is outside of the db directory: README.txt (just an explanation that this is a Subversion repo, doesn't matter) conf (directory with configuration files, mostly for use when used with svnserve, isn't important for recover the contents of the repo) format (specifies the format of the subversion repo, this should be a file with nothing more than "5\n" in it and hasn't changed since Subversion 1.4.x) hooks (directory with hook scripts, not needed to read data out of a repo) locks (lock files location for really old repositories not used since before 1.3.x)

svnadmin recover isn't really all that helpful in a case like this. It's largely for BDB based repositories (which you probably aren't using). It doesn't do much in FSFS repositories.

However you ought to be able to do:

svnadmin create new-repo
rm -rf new-repo/db
cp -a old-repo/db new-repo

I'd suggest once you do that creating another new repo and dumping and reloading into it:

svnadmin create final-repo
svnadmin dump new-repo | svnadmin load final-repo

It's possible you have a repo with a version of Subversion before 1.4.x in which case you may have to manipulate the format file a bit. You can see the history of the format file here (near the top, read the comment before SVN_REPOS__FORMAT_NUMBER): https://svn.apache.org/repos/asf/subversion/trunk/subversion/libsvn_repos/repos.h

And of course as always, when trying to recover something work against a copy and not your only copy.

like image 182
Ben Reser Avatar answered Apr 02 '23 00:04

Ben Reser