gitsvnmigrationsvn2git

SVN to Git Migration with Weird Branching


I'm using the KDE svn-all-fast-export to migrate over an ugly 22GB SVN repository to git. The old maintainers did some very weird branching. I'm running into a case where I need to make 2 branches for a single commit.

The tree looks like this

trunk
branch/lots-of_branches
tags/lots_of_tags

So far so good...

Now someone created a new folder, called 'new', by copying (svn copy) the top level tags and branch folder into 'new'. I'm not sure how to create a top level branch and tags folder and create the sub folders too.

My rules are as follows:

match /branch/([^/]+)/
  repository myrepo
  branch legacy/branch/\1
end match

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

This results in lots of branches called legacy/branch/branch_name, but no legacy/branch for the case described above. My questions is, is there a way to create a branch for each branch and also have another branch that updates each time the branch folder is modified?


Solution

  • @thekbb Good idea, but I'm trying to maintain the history. My latest test is the run the current set of rules until it dies then rerun the importer with a different set to generate the top level refs.

    Second set of rules:

    match /branch/
      repository myrepo
      branch legacy/branch
    end match
    
    match /tags/
      repository myrepo
      branch legacy/tags
    end
    

    After that I'd resume the first set of results after the one commit

    ++++++++++++++++++ Update ++++++++++++++++++
    This worked. The second pass is faster than the first since it ignores everything except the commits that touch /branch or /tags.