使用Bitbucket SVN镜像将SVN迁移到GIT

时间:2017-08-03 13:15:29

标签: git svn migration

我们计划将SVN回购迁移到GIT。我们在服务器上用Bitbucket托管整个东西。我找到了一个名为" SVN Mirror"的Bitbucket-Addon。它支持迁移和镜像。

在我测试的时候,我在SVN的结构上有点挣扎。实际上我们有这样的结构:

  

数据库

     
    

管道

         
      

躯干

             
        

PROJECT_1

                 

Project_2

                 

Project_3

      
             

分行

             
        

Branch_1

                 
          

Project_4

                     

Project_5

        
                 

Branch_2

                 
          

Project_6

                     

Project_7

        
      
    
         

实体

         
      

躯干

             
        

PROJECT_1

                 

Project_2

                 

Project_3

      
             

分行

             
        

Branch_1

                 
          

Project_4

                     

Project_5

        
                 

Branch_2

                 
          

Project_6

                     

Project_7

        
      
    
  

这种结构是否适合迁移到GIT中,或者上述SVN结构是否存在潜在问题?

例如在上面提到的Bitbucked插件中,我可以定义分支,标签等的手动映射。

这是建议的:

trunk = trunk:refs/heads/master
branches = branches/*:refs/heads/*
tags = tags/*:refs/tags/*
shelves = shelves/*:refs/shelves/*

关于提到的实际SVN结构,这个建议是否正确?

非常感谢任何帮助:)

提前谢谢

干杯 桑德罗

1 个答案:

答案 0 :(得分:1)

答案取决于您希望如何将SVN存储库拆分为Git存储库。经验法则:如果

some/path/one

  some/path/two

具有大致相同的内容,它们应该位于同一个Git存储库中,否则,如果它们是不相关的项目,则应将它们拆分为不同的Git存储库。

案例1 :所有Databases/XXX/trunk/Project_YYYDatabases/XXX/Branches_ZZZ/Project_YYY的内容大致相同。

在这种情况下,您有1个Git存储库,配置可能如下:SVN URL应为http://server/some/path/Databases(即数据库可以包含在URL中)

trunk = Pipelines/trunk/Project_1:refs/heads/pipelines/trunk/Project_1
branches = Pipelines/trunk/*:refs/heads/pipelines/trunk/*
branches = Pipelines/Branches/*/*:refs/heads/pipelines/branches/*/*
branches = Entities/trunk/*:refs/heads/entities/trunk/*
branches = Entities/Branches/*/*:refs/heads/entities/branches/*/*

案例2:每个Project_YYY都是一个单独的Git存储库。在那种情况下

Project_1的Git存储库将具有以下配置:

trunk = Pipelines/trunk/Project_1:refs/heads/pipelines/trunk/Project_1
branches = Entities/trunk/Project_1:refs/heads/entities/trunk/Project_1

Project_2的Git存储库将具有以下配置:

trunk = Pipelines/trunk/Project_2:refs/heads/pipelines/trunk/Project_2
branches = Entities/trunk/Project_2:refs/heads/entities/trunk/Project_2

Project_3的Git存储库将具有以下配置:

trunk = Pipelines/trunk/Project_3:refs/heads/pipelines/trunk/Project_3
branches = Entities/trunk/Project_3:refs/heads/entities/trunk/Project_3

Project_4的Git存储库将具有以下配置:

trunk = Pipelines/Branches/Branch_1/Project_4:refs/heads/pipelines/Branches/Branch_1/Project_4
branches = Entities/Branches/Branch_1/Project_4:refs/heads/entities/Branches/Branch_1/Project_4

Project_5的Git存储库将具有以下配置:

trunk = Pipelines/Branches/Branch_1/Project_5:refs/heads/pipelines/Branches/Branch_1/Project_5
branches = Entities/Branches/Branch_1/Project_5:refs/heads/entities/Branches/Branch_1/Project_5

Project_6的Git存储库将具有以下配置:

trunk = Pipelines/Branches/Branch_2/Project_6:refs/heads/pipelines/Branches/Branch_2/Project_6
branches = Entities/Branches/Branch_2/Project_6:refs/heads/entities/Branches/Branch_2/Project_6

Project_7的Git存储库将具有以下配置:

trunk = Pipelines/Branches/Branch_2/Project_7:refs/heads/pipelines/Branches/Branch_2/Project_7
branches = Entities/Branches/Branch_2/Project_7:refs/heads/entities/Branches/Branch_2/Project_7

案例3:管道的一个存储库,实体的另一个存储库。你有2个Git存储库,Git存储库 管道将如下所示:

trunk = Pipelines/trunk/Project_1:refs/heads/pipelines/trunk/Project_1
branches = Pipelines/trunk/*:refs/heads/pipelines/trunk/*
branches = Pipelines/Branches/*/*:refs/heads/pipelines/branches/*/*

实体的Git存储库将如下所示:

trunk = Entities/trunk/Project_1:refs/heads/entities/trunk/Project_1
branches = Entities/trunk/*:refs/heads/entities/trunk/*
branches = Entities/Branches/*/*:refs/heads/entities/branches/*/*

我希望你明白这个想法,并根据你的需要创建配置。