CloudServices/Sync/FxSync/WarOnSpinningEventLoop: Difference between revisions
No edit summary |
|||
Line 102: | Line 102: | ||
hg push default # Push to hg.m.o. | hg push default # Push to hg.m.o. | ||
Note that you cannot specify the <tt>-b</tt> flag when you pull, which could lead to other branches traveling from Git to Mercurial. That's bad. Be careful! | Note that you cannot specify the <tt>-b</tt> flag when you pull, which could lead to other branches traveling from Git to Mercurial. That's bad. Be careful! It might be necessary to pull into the private Git repo, strip branches, then use <tt>hg gimport</tt> to get Mercurial back in sync. | ||
=== Merging upstream changes from Mercurial into Git === | === Merging upstream changes from Mercurial into Git === |
Revision as of 20:13, 25 April 2011
Project branch
Mercurial
We have the project branch Alder until 2011-07-30:
https://wiki.mozilla.org/ReleaseEngineering/DisposableProjectBranches#BOOKING_SCHEDULE
This will give us tbpl and such. Hooray!
Cloning from your local s-c (much faster this way!):
hg clone services-central alder # You'll need >| if you're using zsh. echo "[paths]\ndefault = ssh://hg.mozilla.org/projects/alder" > alder/.hg/hgrc echo "sc = ssh://hg.mozilla.org/services/services-central" >> alder/.hg/hgrc cd alder hg pull -u
Now you have an hg repo from which you can
hg pull -u
to update from alder, and
hg pull -u sc
to update from mainline s-c.
Git
We do our work in Git because it sucks less.
I assume you have parallel directories like ~/moz/hg and ~/moz/git.
Cloning:
# Ask me (rnewman) to add you as a collaborator on GitHub, or # fork my repo and clone your fork. cd ~/moz/git git clone git@github.com:rnewman/alder.git cd alder
Now you have a Git mirror of my alder repo, which I keep up to date from Mercurial as needed.
If you wish, you may link to your Mercurial alder repo. This is a two-step process:
- Install hg-git.
- Simply hg push and pull to the git repository directory.
You'll need these lines in your ~/.hgrc:
[extensions] hgext.bookmarks = hggit =
Assuming that your Git version is ahead, because that's where you're working:
# In Mercurial version. cd ~/moz/hg/alder hg bookmark -r default master # Once. hg pull ../../git/alder
(Note that you can't push to your git repo, because it's not bare. Try it and read the warning. You can push to GitHub and pull, though.)
The first time you do this, hg-git needs to create a bunch of files in .hg. This takes a long time. You might want to leave this up to the Merge Viking (rnewman), and simply do all of your work in Git. Or leave this running for a week!
A much better solution is to grab .hg/git-mapfile from an existing repository (e.g., rnewman's), and clone a bare git repo next to it. This gives you
alder # Hg repo .hg git # Git clone of alder git repo git-mappings # Bookkeeping info
You can use an older set of mappings; just run hg gexport -v in the top-level Mercurial repo to update.
The quickest way to push to Git is to descend into .hg/git and use git push. Continue to use hg pull from either a Git repo or a Mercurial repo to bring changesets in.
Remotes
Your Git clone starts off with origin pointing to GitHub. Once we have the Mercurial bridge set up, you can do this:
git remote add hg ~/moz/hg/alder/.hg/git
to pull straight from your local copy.
Merging new work from Git back to Mercurial
So you have a Git feature branch, and you want to get it back into alder for TBPL and eventual merge into services-central. How?
We assume that alder itself plays the role of develop in the git-flow model. That means we're merging feature branches.
See Philipp's fantastic writeup for more.
git checkout master git merge --no-ff -m "Bug 123456: frobnicate." \ bug-123456-frobnicate # Merge feature branch. git push origin master # Put master on GitHub. cd ../../hg/alder # Switch to hg. hg pull git+ssh://git@github.com/rnewman/alder # Treat like a pull from hg. # Merge etc. as necessary. hg push default # Push to hg.m.o.
Note that you cannot specify the -b flag when you pull, which could lead to other branches traveling from Git to Mercurial. That's bad. Be careful! It might be necessary to pull into the private Git repo, strip branches, then use hg gimport to get Mercurial back in sync.
Merging upstream changes from Mercurial into Git
This is easier if you have a remote set up for GitHub:
cd hg/alder git --git-dir .hg/git remote add github git+ssh://git@github.com/rnewman/alder
Now you can do this:
hg pull -u default # Get our branch in order. hg pull -u sc # Fetch new stuff from services-central. hg merge # Execute a normal merge. hg commit -m "Merge services-central into alder." hg push default # Push to alder hg repo. hg gexport # Update the private git mirror. git --git-dir .hg/git push github # Push to GitHub. cd ../../git/alder # Switch to git. git checkout master # Either, pull from GitHub: git pull origin master # Pull new changes from GitHub. # or pull from the local Mercurial private mirror: git pull hg master # Rebase or merge branches as necessary.