hg-fast-export.py: Rewrite merge logic
commitee510bb02279bedb57a60847fc2927b9f136b048
authorRocco Rutte <pdmef@gmx.net>
Mon, 22 Oct 2007 08:06:58 +0000 (22 10:06 +0200)
committerRocco Rutte <pdmef@gmx.net>
Mon, 22 Oct 2007 08:06:58 +0000 (22 10:06 +0200)
treee42fbd6cf57050d4375d66b0ab67402026161cb5
parent8551771d2b3ce508a6d901f7cde6818d4e20e361
hg-fast-export.py: Rewrite merge logic

Merges were completely broken as they ended up with twice the same
parent in git. Still everything besides gitk seemed to work.

This because of 1) the incorrect assumption that a commit's parent is
the commit exported right before it and 2) some confusion with markes
being saved/loaded/used since git-fast-import doesn't allow for a ":0"
mark to map hg revision 1:1 to marks.

The merge "algorithm" now works like this:

1) If the commit's higher parent (highest hg rev), is not the last
commit exported for a particular branch, we issue a "from" command to
place it on top of it.

2) If the commit's lower parent exists, we issue a "merge" for it.

This is much simpler and seems to produce correct merges in git. And
while I'm at it, make output less confusing by prepending the target
branch name to each line.

The "twice the same parent" bug was discovered by Michele Ballabio on
the git list.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
hg-fast-export.py