-
Notifications
You must be signed in to change notification settings - Fork 34
git remote hg
'git-remote-hg' is the official Mercurial bridge from Git project, once installed, it allows you to clone, fetch and push to and from Mercurial repositories as if they were Git ones:
git clone "hg::http://selenic.com/repo/hello"
To enable this, simply add the 'git-remote-hg' script anywhere in your $PATH
:
wget http://goo.gl/1UcmU -O ~/bin/git-remote-hg chmod +x ~/bin/git-remote-hg
That’s it :)
If you are not interested in Mercurial permanent and global branches (aka. commit labels):
% git config --global remote-hg.track-branches false
With this configuration, the 'branches/foo' refs won’t appear.
If you want the equivalent of 'hg clone --insecure':
% git config --global remote-hg.insecure true
If you want 'git-remote-hg' to be compatible with 'hg-git', and generate exactly the same commits:
% git config --global remote-hg.hg-git-compat true
Remember to run git gc --aggressive
after cloning a repository, specially if it’s a big one. Otherwise lots of space will be wasted.
The oldest version of mercurial supported is 1.9. For the most part 1.8 works, but you might experience some issues.
To push a branch, you need to use the "branch/" prefix:
% git checkout branch/next # do stuff % git push origin branch/next
Note: Make sure you don’t have remote-hg.track-branches disabled.
The simplest way is to specify the user and password in the URL:
git clone hg::https://user:[email protected]/user/repo
You can also use the schemes extension:
[auth] bb.prefix = https://bitbucket.org/user/ bb.username = user bb.password = password
Finally, you can also use the keyring extension.
However, some of these features require very new versions of 'git-remote-hg', so you might have better luck simply specifying the username and password in the URL.
The only major incompatibility is that Git octopus merges (a merge with more than two parents) are not supported.
Limitations of the remote-helpers' framework apply. In particular, these commands don’t work:
-
git push origin :branch-to-delete
-
git push origin old:new
(it will push 'old') (patch available) -
git push --dry-run origin branch
(it will push) (patch available)
There are other 'git-remote-hg' projects out there, do not confuse this one, this is the one distributed officially by the Git project:
For a comparison between these and other projects go here.