Sunday, 4 September 2011

Combining multiple SVN repositories into one

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:
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

What about the revision numbering?
Let's assume that you have to repositories, one with HEAD revision 100 and the other with HEAD revision 150.

You dump the first repository and load it in the new one: you end up with the full story of the first repository, from revision 0 to revision 150.

Then you dump the second repository and load it in the new one: it gets loaded with its full history, the only things that change are the actual revision numbers. The history of the second repository will be represented in the new repository from revision 151 to revision 250.

The full history of both repositories is preserver, only the revision numbers change for the repository that is imported for second.

The same of course applies for more than two repositories.

Possibly Related Posts

1 comment:

  1. The svnadmin load command does not work like that