1
votes

I am working on a piece of software that has four different projects. Each of these projects is stored in a separate SVN repository, with a trunk and two branches.

So it looks like this

repo1
    trunk
        src
    branches
        branch1
            src
        branch2
            src

etc...

repo4
    trunk
        src
    branches
        branch1
            src
        branch2
            src

What I want to do is combine these repositories into a single repository so that I can do switches, merges, and history in a single repository and not have do deal with four different ones.

So I envision it looking like this in the end

repo
    trunk
        project1
            src
        etc...
        project4
            src
    branches
        branch1
            project1
                src
            etc...
            project4
                src
        branch2
            project1
                src
            etc...
            project4
                src

Is it possible to do this? I have looked at Combining multiple SVN repositories into one which discusses how to have trunk branches tags inside each project, but I would like the projects to be contained within the different standard SVN folders (unless there is a good reason not to).

1
If you want it including history, it would require a lot of rewriting the output of svnadmin dump (at least Node-path & Node-copyfrom-path, but there may be others. Doable, but time-consuming. The other solution you linked to is a helluvalot easier. It would even be easier to load the paths in that link & then just manually mv them to the desired location if the total number of tags/branches isn't that high.Wrikken
So if I do that then it would break the history?skynet
No, with the "including history", what I meant to say was I assume you want that (because otherwise, well, you can just set up the desired tree in a filesystem in do 1 huge commit. Neither of the mentioned solutions break the history, although when you make an error in rewriting the dump you might accidentally break something.Wrikken
@Wrikken used your second suggestion and it worked like a charm, thanks!skynet

1 Answers

1
votes

Using the answer on the question I linked and suggestions from Wrikken, I managed to get this working.

The first step is to dump the existing repositories

svnadmin dump > project1.dmp

now create a new folder in the combined repo

svn mkdir http://myserver/svn/repo/project1

then load them into the new repository

svnadmin load --parent-dir "project1" < project1.dmp

now go into project1 folder and move

svn mv http://myserver/svn/repo/project1/trunk http://myserver/svn/repo/trunk/project1
svn mv http://myserver/svn/repo/branches/branch1 http://myserver/svn/repo/branches/branch1/project1

now delete the project1 directory

svn delete http://myserver/svn/repo/project1

and do the same for the other repos you want to merge.