Using Mercurial with Git Repositories
Git: the cool new kid on the block when it comes to revision management. Everyone's using it. Only problem? Like many tools designed by and for the *NIX crowd, its efficiency is almost beyond reproach but its interface can be daunting.
Mercurial (Hg): architecturally almost identical to Git, but developed with usability in mind -- especially in non-Linux settings. It boasts a well-supported, well-used plugin for Eclipse in
MercurialEclipse, and similarly a Windows GUI extension in
TortoiseHg. It also has the nod from Google via support on Google Code.
Fortunately, it's possible to work with Hg, but synch changes with a public Git, by using the hg-git plugin (
http://mercurial.selenic.com/wiki/HgGit
). Git power users aren't alienated, but the rest of us can have a user-friendly experience.
TortoiseHg and Git repositories
Note: One could jsut use
TortoiseGit, but many people seem to like
TortoiseHg more. Not being a Windows user, I can't comment from experience, but I can verify the below works on a test system.
Good tutorial:
http://candidcode.com/2010/01/12/a-guide-to-converting-from-mercurial-hg-to-git-on-a-windows-client/
Note that you do NOT need to install
OpenSSH; see below:
In order to check out a git repo shared via ssh, one extra change is needed: make a copy of
TortoisePlink.exe called ssh.exe in the
TortoiseHg install directory. Now you can clone a repo like git+ssh://okanagan.cs.ubc.ca/ubc/cs/project/arrow/git/CPAIOR10.
To set up a ssh key, use the included Pageant ssh agent; see:
http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter9.html#pageant
alternatively:
http://stackoverflow.com/questions/2951011/how-to-let-tortoisehg-mercurial-on-windows-use-the-private-key-file-generated
If you need a putty .ppk key corresponding to an existing id_rsa or id_dsa private key:
http://linux-sxs.org/networking/openssh.putty.html
The Git eclipse plugin sucks; no merge support, etc. Until it gets better, the Mercurial plugin is a lot better, and can be used by using hg-git.
To do so on OSX, I recommend using macports to install (apologies if it makes you build gcc...)
port install python26 (pay attention to the output, and do what it says to change the default python to the new version, OSX ships with a crippled old version)
port install py26-setuptools
port install mercurial
port install dulwich
then follow the instructions for hg-git at:
http://mercurial.selenic.com/wiki/HgGit
And install
MercurialEclipse as per:
http://javaforge.com/project/HGE
Note that HGE requires a standalone command-line install of Hg, which we did above.
For Windows or Linux, the above should give you an idea. Basically, if you can install
MercurialEclipse and can install hg-git, things should just work.
--
ChrisNell - 23 Jun 2010