Upstreaming patches to android-sync for people who like to pretend android-sync doesn’t exist

I find it rather irritating to have to keep manually upstreaming things to android-sync, and nobody seemed to have automated this.

Behold: a magical script for this. Unfortunately it uses mq, but it shouldn’t be a big deal to refactor it for less terrible ways of doing things.

So, you’ve written a patch that touches both Fennec and a-s code. You got it reviewed and now you’ve landed it on fx-team. It’s time to upstream the a-s changes, ideally before someone starts shouting at you for the merge failures you’ve created.

qpush the mixed patch, invoke the script, and copy-paste the pull request url it prints into bugzilla. It automagically sucks the a-s-specific stuff out of your patch, creates a branch named bug-$NUMBER_FROM_COMMIT_MESSAGE-$NAME_OF_PATCH_FILE with it and issues a pull request on a-s (leaving your original patch unchanged).


  • hub A wrapper script for Git that makes interacting with GitHub much nicer. If you use GitHub you should already be using this. `git pull-request` becomes a thing.
  • moz-git-tools A bunch of handy scripts for working with Git at Mozilla. All we want from it is hg-patch-to-git-patch. Make sure that script at least it on your path (or update my script to point to it wherever you put it).

Stick the script somewhere handy, make sure you set up the config variables at the top in the obvious way, and have fun.

In the event a patch doesn’t apply cleanly, you’ll have to go and manually fix it up in your local a-s repo using `git am` in the usual way, before continuing. The script pauses after trying to apply the patch so you have a chance to do this before it finishes up and publishes anything.

The script (apparently my blog mangles inline code rather horrifyingly):