You're not currently signed in.

How to recover your SVN master repository from your local SVK mirror

When you're having lost your master repository from where you've mirrored your project to work on it locally, you can not (yet) do a complete reconstruction of your master repository, but you're still able not to lose your history.

Some drawbacks

  • Everybody has to recheckout their working copies as it is not a complete recovery (not yet possible).
  • I said you will be able to preserve history, but I didn't say that it preserves the dates/times of their commmits; hence you are able to pass a header to each commit, to see what dates these have ''been''.

What I assume

  • Your mirror is in //projects/foo
  • The path of the recreated master repository is /tmp/foo-recovered
  • you have the most recent version of this repsoitory and though, are in sync with your crunched svn master repository

What you need to do is

  • Create an empty repository: svnadmin create /tmp/foo-recovered
  • Mirror this empty repository into svk: svk mirror //projects/foo-new
  • Merge from old local mirror back into the new repository: svk smerge --remoterev //project/foo //projects/foo-recovered

This will take some time, regarding the prior commit activity on your project.

Once finished, you can load your new master repository (/tmp/foo-recovered) up to your server, prepare your server config to serve the new repository and drop a note to every developer/user that they shall recheckout this repository.

Not that ideal yet, but maybe, we gonna get a perfect recovery method on the next release ;-)

Rem's take on this

I tackled this as an svn rather than an svk problem. Given the current limitations I am not sure there is an advantage to dealing with this at the svk level. Native svk support would change this situation. :)

  • {{svnadmin dump > dump}}
  • I had to use {{svndumpfilter}} to extract the mirrored path that I wanted (I was mirroring more than one repository). Then I used sed to perform {{s/^Node-path: mirror\/project\//Node-path: /}} and {{s/^Node-copyfrom-path: mirror\/project\//Node-copyfrom-path: /}}.
  • {{svnadmin create new-master-path}}
  • {{svnadmin load --ignore-uuid new-master-path < dump}}

All the above disadvantages apply except that the dates of your commits will be correct. The hacking of the dump file is not a robust procedure; it could make incorrect changes and potentially be an incomplete solution for some repositories. (If you want to hack less you can live with a changed mirror path. You might need to create the base directory before the {{svnadmin load}} command will work.)

HTH.

- Rembrandt Kuipers

Removing svm properties (extendsion to Rem's suggestion)

Edit the dump with ed (ed dump) before running {{svnadmin load}}:

  • {{1,$g/^svm:headrev/-1,+3d}}
  • {{1,$g/^svm:/-1,+2d}}
  • {{1,$g/^svk:/-1,+2d}}
  • {{w}}
  • {{q}}

- Thomas Kühne