hg-fast-export: Compare HG revisions when merging

hg-fast-export uses hg's branch order (from the log) when merging,
this is a problem. Consider the case:

HG repo A  has revisions 1-10. Repository B is cloned from that.
Subsequently, A adds revision 11, and B adds a different change which
also has revision 11. If B now pulls from A, A's rev11 will have the
number 12; if A then pulls from B, the reverse also holds. So the logs
are different even though they contain the exact same changes.

hg-fast-export will thus create different git repositories for A and B,
even though the contents are identical for all practical purposes.
In particular, the repos would be identical if A and B had used git from
the beginning.

To fix that, compare HG revisions instead of log positions.
This commit is contained in:
Matthias Urlichs
2008-11-16 15:43:44 +01:00
committed by Frej Drejhammar
parent 688623f17e
commit 0306977b28

View File

@@ -180,8 +180,10 @@ def export_commit(ui,repo,revision,marks,mapping,heads,last,max,count,authors,so
wr()
pidx1, pidx2 = 0, 1
if parents[0] < parents[1]:
pidx1, pidx2 = 1, 0
if parents[1] > 0:
if parents[0] <= 0 or \
repo.changelog.node(parents[0]) < repo.changelog.node(parents[1]):
pidx1, pidx2 = 1, 0
full_rev=False
if revision==0: full_rev=True