[plt-dev] Migrating branches to git

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Apr 10 16:29:08 EDT 2010

On Apr 10, Robby Findler wrote:
> I propose that Eli declare some date at which point he will take the
> current SVN trunk and move it over to git. If anyone wants to get
> their branches (past present or future) into git they can ask him
> for help (and he might give it) but it is their own responsibility.
> 
> (To me, the below just looks like too much trouble to be worth
> anything.)

Well, trying to get it done automatically turns out to be a huge
PITA.  But in cases where it really matters I can deal with it if I'm
given the exact information.

I should have talked a bit on what exactly I'll do with it: given the
same commit history example:

  ...
  r10: change on the trunk
  r11: copy trunk to branches/foo/bar
  r12: change on branches/foo/bar
  r13: change on the trunk
  r14: change on branches/foo/bar
  r15: merge branches/foo/bar to the trunk (which is a change on it)
  r16: change on the trunk
  ...

I'll specify that the `foo/bar' branch should be preserved.  With the
lack of merge detection, this will prodice the following commit
history in git:

   r10
    |  \?
    |   r11
    |    |
   r13  r12
    |    |
    |   r14
    |  /?
   r15
    |
   r16

where the two problematic links are marked with a "?".  The first one
will usually be generated, the last one will not.  So at that point,
and given the merge topology information from people who'd want to
preserve this, I'll use the git grafts feature.  This feature allows
me to set parent links explicitly: so I'll set r10 as the parent of
r11 (unless it is detected), and set both r13 and r14 as the parents
of r15.  (Actually I'll do that for the sha1 of the corresponding git
revisions.)  This forces the above picture (with proper links where
the question marks are), and another global operation on the newly
created repository makes these links become part of the repository.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.