Combining multiple SVN repositories into one

svn

After considering the answers to my previous question (One SVN Repository or many?), I've decided to take the 4 or so repositories I have and consolidate them into one. This of course leads to the question, what's the best way to do this?

Is there a way to combine two or more repositories maintaining the version history for both?

Edit: I should also point out that I'm using Assembla.com, which does not provide access to the svnadmin command, AFAIK

Another edit: Does this even matter? If svnadmin works on URLs, then it's no problem then.

Best Answer

Edit: Oh well, the question edit was made while I was typing. This is an answer to

Is there a way to combine two or more repositories maintaining the version history for both?


Assuming that

The existing repositories have a structure like:

  • repository root
    • branches
    • tags
    • trunk

and you want a structure something like:

  • repository root
    • projectA
      • branches
      • tags
      • trunk
    • projectB
      • branches
      • tags
      • trunk

Then for each of your project repositories:

svnadmin dump > project<n>.dmp

Then for each of the dump files:

svn mkdir "<repo url>/project<n>"
svnadmin load --parent-dir "project<n>" <filesystem path to repos>

More complex manipulations are possible, but this is the simplest, most straightforward. Changing the source repository structure during a dump/load is hazardous, but doable through a combination of svnadmin dump, svndumpfilter, hand-editing or additional text filters and svnadmin load


Dealing with a third party provider

  • Request svnadmin dump files for each of your repositories. The provider should be willing/able to provide this - it is your code!
  • Create an SVN repository locally.
  • Perform the actions listed above for the dump files.
  • Verify the repository structure is correct with your favorite client.
  • Create a dump file for the combined repositories.
  • Request that the provider populate a new repository from this dump file.

YMMV: This seems to be a reasonable approach, but I've never worked with a third party provider like this.