Git as mercurial client? Why no git-hg?
Solution 1:
I haven't tried this, but there seems to be a git-hg project. The project describes itself on the page and the README as:
A git-hg utility for checking out and tracking a mercurial repo.
A set of scripts for checking out and tracking a mercrial [sic] project.
It doesn't seem to work bi-directionally though (see issue tracker).
Solution 2:
There is another project to realize this: git-remote-hg. Actually two of them, a native one (see https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg) and another one based upon hg-git (see https://github.com/rfk/git-remote-hg). The former is much faster than the latter, but still incomplete and under development.
There are actually git remote helpers (as these tools are called) for other systems, either already there or under development; this includes support for Subversion, CVS, bazaar, and even MediaWiki.
Cloning a Mercurial repository via git then is simply done like this:
git clone hg::https://hg.example.com/some-mercurial-repo
UPDATE: By now there is a third one, also "native", namely the one by Felipe which he mentions in his answer here. This one looks like it soon might be part of the git 'contrib' dir: https://github.com/felipec/git-remote-hg It works without requiring patches to git itself, though some patches to git (under review now) can be applied to improve the overall user experience.
UPDATE 2: And now there is yet another contender, this one being under quite active development, and based on felipe's code: https://github.com/buchuki/gitifyhg -- it works quite well for me so far, but there are still some rough spots.
UPDATE 3: Both gitifyhg and Felipe's git-remote-hg are currently not actively maintained. For the time being, I made a form of Felipe's code with some fixes, including some to make it work with recent Mercurial versions. You can get it from https://github.com/fingolfin/git-remote-hg. Finally, therere is yet another recent contender, git-cinnabar
, using a completly different approach internally (though if you don't care about that, using it is more or less the same as for the other git-remote-hg implementations). I have not yet tried it myself, but you can find it at https://github.com/glandium/git-cinnabar
Solution 3:
hg-git and the author's Pycon presentation explaining his take on the situation.not sure if you came across these while googling but they answered my questions.
Solution 4:
hg-git apparently can be used to work with git locally, with a remote mercurial repo: http://traviscline.com/blog/2010/04/27/using-hg-git-to-work-in-git-and-push-to-hg/
Don't miss the comments there too.
Solution 5:
Somebody already mentioned two git-remote-hg's, but here's a new one:
Bridge support in git for mercurial and bazaar
It has more features and should work more reliably than the msysgit one, but most importantly; you don't need any dependencies or a custom git build. Just copy to your $PATH, and that's it.
It has extensive tests to check that the output is exactly the same as hg-git, so it should work at least as well.