Mercurial includes a Git conversion script in contrib/convert-repo.

To use, run:

convert-repo <git-dir> <hg-dir> <mapfile>

(don't forget to create the <hg-dir> repository beforehand)

The <mapfile> is a simple text file that maps a git commit hash to the hash in Mercurial for that version, like so:

<git hash> <mercurial hash>

If the file doesn't exist, it's automatically created. It's updated on each commit copied, so convert-repo can be interrupted and can be run repeatedly to copy new commits.