How do I know my git repository is same as my Mercurial repository?

Viewed 75

I converted my Mercurial repository(in Bitbucket) to git (gitLab), I am wondering that how can I know that no files/comments were missing? How to check if two repositories are the same?

Thanks, Jennifer.

2 Answers

You cannot compare SHA1 hashes between Git and Mercurial (they would be different anyway)

But you can at least script and compare:

And see if the list has the same number of elements and if the comments matches

For each commit, you can:

And make sure each one:

  • has the same number of files.
  • has the same content, by comparing them with a diff tool (kdiff3 or, as suggested below, WinMerge if you are on Windows)

Using a diff tool alone is not enough: you need to do it revision by revision.

If you have a copy of the original HG and new Git repos locally, you can use a program like WinMerge to diff both folder trees.

Excluding the "internal" files like .hg you should find an identical set of files at the heads of both.

Personally I like this approach because it is independent of the source control systems themselves. If you don't fully trust the Git conversion in the first place, I think its sensible to check the "facts on the ground" directly without going through any extra intermediate steps.

Related