Search code examples
gitsvngitlabgit-svn

Problems when migrating a repository from SVN to GITLAB


I have a very large repository in SVN with the following structure:

http://mycompany.com/svn/something/
│   
│  
│
└───branches
│   │   
│   └───MyProject_FIX
│   │   │   
│   │   └(SOURCE CODE)   
│   │   
│   └───MyProject_Branch2
│   │   │   
│   │   └(SOURCE CODE) 
│   │
│   │
│   │
│   └───OtherProject_FIX
│       │   
│       └(SOURCE CODE)   
│
│
│
└───tags
│   │   
│   └───MyProject
│   │   │   
│   │   └1.0.0
|   |   |  └(SOURCE CODE)
│   │   │
|   │   └1.0.1
|   │   |  └(SOURCE CODE)
│   │   │
|   │   └1.0.3    
|   │   |  └(SOURCE CODE)
│   │   │
|   │   (...)
│   │   │
│   │   └latest
│   │
│   └───OtherProject   
│
└───trunk
    |
    └───MyProject
    |    |
    |    └─(SOURCE CODE)
    |
    └───OtherProject
         |
         └─(SOURCE CODE)   

I have tried almost everything:

And the only think that I have achieved is to import the same structure of the SVN repository with the commits.

What I would like to do is to convert the tag folder intro real git tags, the branch folder intro real branches and import only MyProject (Ignoring the OtherProject)

Finally I have to say that the repository is quite large (I don't know if this detail is important)

Is there any straightforward way to convert this repository?

Thank you in advance!


Solution

  • Sounds like you need to use the trunk/branches/tags command line options for git svn:

    git svn clone --trunk=/trunk/MyProject --branches=/branches/MyProject_Branch2 --branches=/branches/MyProject_FIX --tags=/tags/MyProject http://mycompany.com/svn/something/ <dest repo>
    

    This should pull out just MyProject.

    Remember to include your authors file and put in --prefix== to ensure that the atlassian clean up script that converts svn tags to real tags works properly.