Search code examples
gitgit-svn

git svn tool to migrate from SVN containing multiple duplicate repositories


I am working on a project where SVN repo contains duplicate repositories

/trunk/project_v1
/trunk/project_v2
/trunk/project_tomcat_migration_v3
/trunk/empService1
/trunk/empService2
/trunk/empService_random_string_v3

  .
  .

Tags also contains duplicate repositories.

  1. I want to pick the latest version of project svn repository (say project_tomcat_migration_v3) and push it to git repository on master. Rest of the duplicate repositories (say v1 and v2), I want to push on a separate branch. is there any way to achieve this using git svn command.
  2. If the above thing is not possible with git svn is there any way to clone SVN repo and it to the branch of existing git repo
    something around the line as below:

git svn clone http://url/trunk//trunk/project_v2 --separate_branch_on_existing_repo


Solution

  • Use svn2git. You can use paths specify which repo.

    https://github.com/svn-all-fast-export/svn2git

    create repository project_v1
    end repository
    
    create repository project_v2
    end repository
    
    match /trunk/project_v1/
    repository project_v1
    branch master
    end match
    
    match /trunk/project_v2/
    repository project_v2
    branch master
    end match
    

    Note: tags are branches in SVN and must be declared a little different. ([^/]+)/ is used to match tag name.

    match /tags/project_v1/([^/]+)/
    repository project_v1
    branch refs/tags/\1
    annotated=true
    end match