Two main areas of work: we spin the event loop to wait for queries, and we spin to wait for HTTP requests. This allowed Sync to be programmed in a synchronous, procedural way, rather than as a giant web of callbacks.
Spinning the event loop is bad, so we need to change this.
bug 652221: use AsyncResource everywhere. The implementation of this necessarily includes "make most of Sync use callbacks"; see Services/Sync/WEP/116. I'm about half done with this in branches in services-hacking.
(no bug yet): eliminate queryAsync/querySpinningly.
We do our work in Git because it sucks less.
I assume you have parallel directories like ~/moz/hg and ~/moz/git.
# Ask me (rnewman) to add you as a collaborator on GitHub, or # fork my repo and clone your fork. cd ~/moz/git git clone email@example.com:rnewman/services-hacking.git cd alder
Now you have a Git mirror of my hacking repo, which I keep up to date from Mercurial as needed.
If you wish, you may link to a Mercurial 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/services-hacking hg bookmark -r default master # Once. hg pull ../../git/services-hacking
(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 services-hacking 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.
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/services-hacking/.hg/git
to pull straight from your local copy.
Merging new work from Git back to Mercurial (stale after elimination of alder HG repo)
So you have a Git feature branch, and you want to get it back 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://firstname.lastname@example.org/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 (stale after elimination of alder HG repo)
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://email@example.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.