如何使用svnadmin合并两个subversion存储库

时间:2014-11-06 16:38:16

标签: svn merge repository

如何在Debian Wheezy上合并两个subversion(1.6)存储库,假设存储库布局如下:

reposA
    +-trunk
        +-project-1
        +-project-2
        +-project-3
    +-tags
        +-project-1
    +-branches
        +-project-1

reposB
    +-trunk
        +-project-4
        +-project-5
        +-project-6
    +-tags
        +-project-4
    +-branches
        +-project-4

目标布局应如下所示:

reposAB
        +-trunk
            +-project-1
            +-project-2
            +-project-3
            +-project-4
            +-project-5
            +-project-6
        +-tags
            +-...
        +-branches
            +-...

我已经尝试过的是:

svnadmin dump reposA > reposA.dmp 
svnadmin dump reposB > reposB.dmp
svnadmin create new_common_repos
svnadmin load new_common_repo < reposA.dmp 
svnadmin load new_common_repo < reposB.dmp

1 个答案:

答案 0 :(得分:0)

您可以将两个转储加载到单独的子文件夹,然后根据需要重新排列:

svnadmin create new_common_repo
svn mkdir file:///path/to/new_common/repo/reposA -m "Created folder reposA"
svnadmin dump reposA | svnadmin load new_common_repo --parent-dir reposA
svn mkdir file:///path/to/new_common/repo/reposB -m "Created folder reposB"
svnadmin dump reposB | svnadmin load new_common_repo --parent-dir reposB

然后为每个项目:

svn mkdir file:///path/to/new_common/repo/trunk -m "Created folder trunk"
svn mv file:///path/to/new_common/repo/reposA/project-1  file:///path/to/new_common/repo/trunk/project-1