I have converted a Mercurial project ( which has huge history) to Git project using fast-export tool. Now I want to verify that it didn't missed any history in the migration, is there any automation way to cross-check the history?
Asked
Active
Viewed 129 times
2
-
A not very thorough, but easy, test is to count the revisions: `git rev-list --count --all` vs `hg id -n tip`. Unless there are special situations, the two counts should match, since there should be one commit in Git for each commit in Mercurial. – torek Jan 05 '18 at 17:43
-
`hg id -n tip` will not give you the number of revisions in any reliable form. It will already be off, if you used at least once `hg commit --amend` or similar. Something like `hg log -T".\n" | wc -l` will be more reliable – planetmaker Jan 05 '18 at 23:06
-
@planetmaker: I made a trivial repo, committed twice (so that tip was rev 1), then made a change and `hg commit --amend`ed. The tip ID is still 1. Mercurial has to strip out "amended" commits (`saved backup bundle to .../87af93bacd8a-10005142-amend.hg`). Did I miss something else other than forgetting the `-r` flag? :-) (need `hg id -n -r tip`, not just `hg id -n tip`) (Maybe you have the Evolve extension added? I'm not sure what converters do with that) – torek Jan 05 '18 at 23:39
-
Yeah, as soon as there are obsolete changesets, the `hg id -n` will not give you a correct estimate. Might be that w/o evolve none are created, even when you use amend. I thought they would. – planetmaker Jan 06 '18 at 07:50
1 Answers
0
I have not done this myself, but I would look into re-exporting back to Mercurial from Git. Then compare hg to hg and make sure you get exactly the same thing back. Capturing hg log
to a text file for the original and copy, and then diffing the files might work.

StayOnTarget
- 11,743
- 10
- 52
- 81