Had to import a repository from Mercurial to Git today.
I used fast-export:
git clone git://repo.or.cz/fast-export.git
Because the author fields were an utter mess, I needed to create an authors map. This is not well documented but it’s of the form email address to author <email>. For example:
Administrator@MACHINE.localdomain=Bob McBadgers <bob@badgers.st> badgerbob@gmail.com=Bob McBadgers <bob@badgers.st> badgerbob@MyMachine=Bob McBadgers <bob@badgers.st>
You then create a new git repo, e.g.
mkdir myapp.git ; cd myapp.git git init --bare --shared=group ../fast-export/hg-fast-export.sh -A ../authors.map -r ../myapp.hg/
If it produces an empty repo, ensure you have the Mercurial Python modules available.