This is the Hg-Git plugin for Mercurial, adding the ability topush to and pull from a Git server repository from Mercurial. This means you can collaborate on Git based projects from Mercurial, or use a Git server as a collaboration point for a team with developers using both Git and Mercurial.

The Hg-Git plugin canconvert commits/changesets losslessly from one system to another, so you can push via a Mercurial repository and another Mercurial client can pull it. In theory, the changeset IDs should not change, although this may not hold true for complex histories.
hg clone git://github.com/schacon/some-repo.git
Like with normalhg clone, you can optionally specify a destination directory.
$ cd mercurial-repo$ hg bookmark -r default master # so a ref gets created
To avoid specifying the repo path when you push and pull, edit.hg/hgrc and add:
[paths]default = git+ssh://git@github.com/schacon/some-repo.git
See the Mercurial docs for more detail on path settings.
$ hg push
This will convert all Mercurial data into Git objects and push them up to the Git server.
$ hg pull
That will pull down any commits that have been pushed to the server in the meantime and give you a new head that you can merge in.
First, make sure that you have a working C compiler on your system. On Windows, one option is the freeMicrosoft Visual C++. (Be sure to install the 2008 version for compatibility reasons.) On Debian-style Linux, runapt-get install python-dev.
Secondly, runeasy_install hg-git. If you don't have easy_install available, you can get it as part of Python'ssetuptools package.
Alternatively, on Windows,TortoiseHg comes with hg-git (and Dulwich), though itstill needs to be enabled as shown below (or through the TortoiseHg settings).
Lastly, make sure the following is in your~/.hgrc:
[extensions]hgext.bookmarks =hggit =
...and that's it!
Use this method if you'd like to install a clone of the Hg-Git repository rather than a static package, or if you'd like to install Hg-Git in a location you choose yourself.
First, install version 0.8.0 or newer ofDulwich. You can doeasy_install 'dulwich>=0.8.0' if you havesetuptools installed. Next, clonethe Hg-Git repository somewhere. Lastly, make the 'extensions' section in your '~/.hgrc' file look something like this:
[extensions]hgext.bookmarks =hggit = [path-to]/hg-git/hggit
That will enable the Hg-Git extension for you. The bookmarks section is only required prior to hg 1.7. Bookmarks will be translated to git heads when pushing.
Different versions of hg-git are known to work with different versions of Mercurial. For the most accurate info, go tothe source on Heptapod, click the dropdown menu that says "branch/default", select the tag corresponding to the version you've installed, and click on the file "Makefile". There's a line that starts with "all-version-tests" which lists the versions of Mercurial known to work.
It also needs Dulwich version 0.8.0 or later; Dulwich is a pure-Python implementation of the Git file formats and protocols. There areno Git binary dependencies: you do not need to have Git installed on your system.
Source available athttps://foss.heptapod.net/mercurial/hg-git. Patches preferred via email to thehg-git mailing list.