Mike Hommey: Using a git clone of gecko-dev to push to mercurial |
The next
branch of git-cinnabar now has minimal support for grafting, enough to allow to graft a clone of gecko-dev
to mozilla-central
and other Mozilla branches. This will be available in version 0.3 (which I don’t expect to release before June), but if you are interested, you can already try it.
There are two ways you can work with gecko-dev
and git-cinnabar.
This is the recommended setup.
There are several reasons one would want to start from gecko-dev
instead of a fresh clone of mozilla-central
. One is to get the full history from before Mozilla switched to Mercurial, which gecko-dev
contains. Another is if you already have a gecko-dev
clone with local branches, where rebasing against a fresh clone would not be very convenient (but not impossible).
The idea here is to use gecko-dev
as a start point, and from there on, use cinnabar to pull and push from/to Mercurial. The main caveat is that new commits pulled from Mercurial after this will not have the same SHA-1s as those on gecko-dev
. Only the commits until the switch will. This also means different people grafting gecko-dev
at different moments will have different SHA-1s for new commits. Eventually, I hope we can switch gecko-dev
itself to use git-cinnabar instead of hg-git, which would solve this issue.
Assuming you already have a gecko-dev
clone, and git-cinnabar next
installed:
$ git remote set-url origin hg::https://hg.mozilla.org/mozilla-central
(replace origin
with the remote name for gecko-dev
if it’s not origin
)
$ git remote add inbound hg::https://hg.mozilla.org/integration/mozilla-inbound $ git remote add aurora hg::https://hg.mozilla.org/releases/mozilla-aurora (...)
$ git -c cinnabar.graft=true -c cinnabar.graft-refs=refs/remotes/origin/* remote update
(replace origin
with the remote name for gecko-dev
if it’s not origin
)
$ git remote set-url --push origin hg::ssh://hg.mozilla.org/mozilla-central $ git remote set-url --push inbound hg::ssh://hg.mozilla.org/integration/mozilla-inbound $ git remote set-url --push aurora hg::ssh://hg.mozilla.org/releases/mozilla-aurora (...)
Now, you’re mostly done setting things up. Check out my git workflow for Gecko development for how to work from there.
This setup allows to keep pulling from gecko-dev
and thus keep the same SHA-1s. It relies on everything pulled from Mercurial existing in gecko-dev
, which makes it cumbersome, which is why I don’t recommend using it. For instance, you may end up pulling from Mercurial before the server-side mirroring made things available in gecko-dev
, and that will fail. Some commands such as git pull --rebase
will require you to ensure gecko-dev
is up-to-date first (that makes winning push races essentially impossible). And more importantly, in some cases, what you push to Mercurial won’t have the same commit SHA-1 in gecko-dev
, so you’ll have to manually deal with that (fortunately, it most cases, this shouldn’t happen).
Assuming you already have a gecko-dev
clone, and git-cinnabar next
installed:
$ git remote add central hg::https://hg.mozilla.org/mozilla-central $ git remote add inbound hg::https://hg.mozilla.org/integration/mozilla-inbound $ git remote add aurora hg::https://hg.mozilla.org/releases/mozilla-aurora (...)
$ git remote set-url --push origin hg::ssh://hg.mozilla.org/mozilla-central $ git remote set-url --push inbound hg::ssh://hg.mozilla.org/integration/mozilla-inbound $ git remote set-url --push aurora hg::ssh://hg.mozilla.org/releases/mozilla-aurora (...)
$ git remote.central.fetch +refs/heads/branches/default/tip:refs/remotes/central/default $ git remote.inbound.fetch +refs/heads/branches/default/tip:refs/remotes/inbound/default $ git remote.aurora.fetch +refs/heads/branches/default/tip:refs/remotes/aurora/default (...)
Other branches can be added, but that must be done with care, because not all branches are exposed on gecko-dev
.
$ git config cinnabar.graft only
$ git config cinnabar.data never
gecko-dev
commits:$ git config cinnabar.graft-refs refs/remotes/origin/*
(replace origin
with the remote name for gecko-dev
if it’s not origin
)
$ git remote update
Retry as long as you see errors about “Not allowing non-graft import”. This will keep happening until all Mercurial changesets you’re trying to pull make it to gecko-dev
.
With this setup, you can now happily push to Mercurial and see your commits appear in gecko-dev
after a while. As long as you don’t copy or move files, their SHA-1 should be the same as what you pushed.
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |