Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion - Merging Repositories [duplicate]

Tags:

svn

When I first setup the SVN structure for my different projects, I decided to place each different project in a separate repository.

This has worked well for a while, but I'm staring to think that I would like to merge all of those repositories into one overall "company-wide" repository so when I have employees check out the source code, they can just checkout from the top and have all the code from all the different projects.

I found the svn-merge-repos command online, but not a lot of user feedback or helpful tips for using it. Is this the best way to join repositories so I don't loose my history data, or is there a better way? Are there any pitfalls that I should watch out for?

Thanks.

like image 556
Ryan Smith Avatar asked Dec 17 '08 20:12

Ryan Smith


1 Answers

I recently had to do something similar and what I did was, in essence:

* svnadmin create X:\Repositories\RepositoryC
* svn mkdir http://localhost:8080/svn/RepositoryC/branches --message "Added the branches folder."
* svn mkdir http://localhost:8080/svn/RepositoryC/tags --message "Added the tags folder."
* svn mkdir http://localhost:8080/svn/RepositoryC/trunk --message "Added the trunk folder."
* svn mkdir http://localhost:8080/svn/RepositoryC/trunk/A --message "Added the trunk\A folder."
* svn mkdir http://localhost:8080/svn/RepositoryC/trunk/B --message "Added the trunk\B folder."
* svn checkout http://localhost:8080/svn/RepositoryC RepositoryC
* svnadmin dump X:\Repositories\RepositoryA > RepositoryA.dmp
* svnadmin dump X:\Repositories\RepositoryB > RepositoryB.dmp
* svnadmin load X:\Repositories\RepositoryC --parent-dir trunk\A < RepositoryA.dmp
* svnadmin load X:\Repositories\RepositoryC --parent-dir trunk\B < RepositoryB.dmp
* svn checkout http://localhost:8080/svn/RepositoryC RepositoryC

NB: The above code assumes that on the machine that hosts your Subversion repositories, the repositories exist on X:\Repositories and the URL to the Subversion server is http://localhost:8080 and the one is in the working folder.

At this point you will end up with RepositoryC that has RepositoryA and RepositoryB in it under trunk\A and trunk\B respectively, and most importantly, your change history will have been maintained for RepositoryA as well as RepositoryB. Your working folder with also contain a folder called RepositoryC that contains a checkout out the RepositoryC.

You can now move things around in RepositoryC to unify the project structures of the two repositories RepositoryA and RepositoryB.

like image 78
Umar Farooq Khawaja Avatar answered Sep 29 '22 14:09

Umar Farooq Khawaja