-
Notifications
You must be signed in to change notification settings - Fork 59
Home
The hg-git
Mercurial extension is required in order to track a Mercurial repository with Git, see below on how it can be enabled.
$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim
Make sure the bookmarks
extension is enabled before this step (see below).
$ hg bookmark master
(Optional) Add bookmark to other Mercurial branches:
$ hg bookmark -r vim73 hg/vim73
Edit vim/.hg/hgrc
and add default-push
path:
[paths]
default-push = git+ssh://git@github.com:b4winckler/vim.git
$ hg push
Whenever the Mercurial repository is updated the Git repository needs to be manually updated (see below on how to enable the fetch
extension which is used in this step).
$ hg fetch
$ hg push
It seems that bookmarks created with the -r
flags are note automatically updated when you fetch the latest changesets, so some extra work is needed for the vim73
branch to be updated (is there a better way to handle this?):
$ hg bookmark -d hg/vim73
$ hg bookmark -r vim73 hg/vim73
$ hg push
Install hg-git
:
$ sudo easy_install hg-git
Enable extensions: edit ~/.hgrc
and add:
[extensions]
bookmarks =
hggit =
fetch =
(The fetch
extension is not required but it simplifies updating the Git repo.)
Note that the hg-git
bridge is lossless, so that:
- If you loose your Mercurial repository, the above steps can be repeated to set up a new one and you can continue updating the Git repository (only new changesets will be pushed).
- If somebody else sets up a Git clone of the Mercurial repository you can git-pull from that to update your own Git clone (the Git commit ids are identical).
- A maintainer of the Mercurial repository can pull changesets into a Mercurial repository from a cloned Git repository.
- You can use Mercurial to clone one of the Git clones (if you prefer using Mercurial over Git). New changesets can be pulled from either the original Mercurial repository or from any Git clone. (Normally you would just clone the Mercurial repository, of course.)