dmolony
dmolony

Reputation: 1135

Restoring SVN repository from backups

I have been using Doug Hellmann's script to back up my repo for 2 years now, and I eventually lost my server hard drive. So I created a brand new repo on another machine, and attempted the restore command, which is:

gunzip -c `ls -tr dump*` | svnadmin load /home/svn/myproject

Only it doesn't work. It gives the response

<<< Started new transaction, based on original revision 917
svnadmin: File not found: transaction '0-1', path 'MineSweeper2/src/com/bytezone/minesweeper2/Game.java'
     * editing path : MineSweeper2/src/com/bytezone/minesweeper2/Game.java ...denis@ubuntu-lianli:~/SVN backups$

Can anyone explain what is wrong here? I have all the incremental backups ever made, surely this is the simplest case scenario.

Incidentally, is it possible to condense the dozen or so backup files into a single file before attempting the load?

Upvotes: 2

Views: 695

Answers (2)

David W.
David W.

Reputation: 107040

I had to take a quick glace at his script. It looks like your doing a dumpfile only on the changes that took place since the last dump and then compressing them.

If that's the case, it should be possible to uncompress all the compressed backups, then concatenate them together in the right order to create a single valid dumpfile.

That in the right order is key. It looks like he keeps revision range in the dump file's name, but the revision numbers aren't zero filled which means sorting on the file names could be an issue.

It might be possible to sort the dump files based upon the cdate or mdate of the backup file, but that's sort of risky.

The name of the dump file is ${dumpfilename}-${repo_name}-${first}-${last}.${compress_ext}, so it is possible to use the - as a field separator and sort on the 3rd field numerically.

sort -t - -k3,3n

That will put them in the correct order. Then you might be able to do something like this:

ls | sort -t - -k3,3n | while read backup
do
    bzcat $backup | svnadmin load $repos
done

Of course, that is completely untested because I hadn't tried Doug Hellmann's script, but that should be pretty close. You can combine everything in a single dump by doing this:

ls | sort -t - -k3,3n | while read backup
do
   bzcat $backup >> $dumpfile
done

Hope that works. Or, at least sends you in the right direction.

Upvotes: 0

madth3
madth3

Reputation: 7344

It seems the backups are not being processed in the right order. svnadmin load reproduces the commits made in the repository to obtain a new copy. It seems is looking to commit a file modification but the file is not created yet because the commits are not in the proper order.

Upvotes: 1

Related Questions