0

We're in the process of switching from svn to git in a project.

Now one of the svn repos that we want to move, has quite a long history that we want to keep. So I've tried doing git-svn clone on it, and it works out fine.

However, the svn repo has been moved three times during its history.

The layout of the whole repo is something like this;

repo_root/
trunk/
    projA_v1 (existed in the beginning)
    projA_v2 (then moved to v2)
    projA_v3 (and finally to v3)
    projB
    projC
branches/
    projA_b1
    projA_b2
    projB_b1
    projC_b1
tags/
    projA_t1
    projB_t1
    projC_t1

The project was at first called projA_v1, then moved to v2 and finally to v3.

Now when we do git-svn clone, we only get the history since the last move from 2 to 3. If we check the logs in svn we see the whole history correctly.

Is there anything I can do to get the whole history? There's about 3 years of lost history there, we'd rather keep it if we could.

Update: I've tried to do git-svn clone on the whole repo now, from repo_root. I thought I could do that and then prune the resulting git repo with the instructions in Detach (move) subdirectory into separate Git repository, it seems to work well. (the pruning bit at least)

There's still problems though. The branches won't behave correctly.. I guess it's because git-svn doesn't recognize them as branches, since the content in one of the branches isn't a copy of the whole trunk, but rather just a portion of the trunk. Any ideas?

In an ideal world I'd end up with a repo consisting of projA only, with the history from projA_v1 and v2, and the history in the projA branches and tags.

Community
  • 1
  • 1
bjarven
  • 771
  • 2
  • 10
  • 27

1 Answers1

1

I found a way that worked for me, but it's very 'un-general' so I'm hesitant to posting it here...

What I found worked for me was to edit .git/config when the project was moved. I did git svn fetch -r to the revision it moved, and then edited config.

In my case the project moved from trunk/v2 to branch/v3 to trunk/v3, and the last move was the most problematic for me. I flipped the trunk and the branches in config, so that the move from branch/v3 to trunk/v3 seemed like a branch. Then I got the whole history.

And I had to do a pretty long --ignore-paths="" with all the other projects that were on the same level.

I don't think this approach would work in some other case, but it could be a good idea to look into modifying config if all else fails.

bjarven
  • 771
  • 2
  • 10
  • 27