While it sounds like I should really switch to a bookmark-based Mercurial workflow for my Gecko development, I figured that before I do that, I should document how I currently use patch queues and Bitbucket.

Starting work on a new bug

After creating a new bug in Bugzilla, I do the following:

Create a new mozilla-central-mq-BUGNUMBER repo on Bitbucket using the web interface and put https://bugzilla.mozilla.org/show_bug.cgi?id=BUGNUMBER as the Website in the repository settings. Create a new patch queue: hg qqueue -c BUGNUMBER Initialize the patch queue: hg init --mq Make some changes. Create a new patch: hg qnew -Ue bugBUGNUMBER.patch Commit the patch to the mq repo: hg commit --mq -m "Initial version" Push the mq repo to Bitbucket: hg push --mq ssh://hg@bitbucket.org/fmarier/mozilla-central-mq-BUGNUMBER Make the above URL the default for pull/push by putting this in .hg/patches-BUGNUMBER/.hg/hgrc : [paths] default = https://bitbucket.org/fmarier/mozilla-central-mq-BUGNUMBER default-push = ssh://hg@bitbucket.org/fmarier/mozilla-central-mq-BUGNUMBER

Working on a bug

I like to preserve the history of the work I did on a patch. So once I've got some meaningful changes to commit to my patch queue repo, I do the following:

Add the changes to the current patch: hg qref Check that everything looks fine: hg diff --mq Commit the changes to the mq repo: hg commit --mq Push the changes to Bitbucket: hg push --mq

Switching between bugs

Since I have one patch queue per bug, I can easily work on more than one bug at a time without having to clone the repository again and work from a different directory.

Here's how I switch between patch queues:

Unapply the current queue's patches: hg qpop -a Switch to the new queue: hg qqueue BUGNUMBER Apply all of the new queue's patches: hg qpush -a

Rebasing a patch queue

To rebase my patch onto the latest mozilla-central tip, I do the following:

Unapply patches using hg qpop -a Update the branch: hg pull -u Reapply the first patch: hg qpush and resolve any conflicts Update the patch file in the queue: hg qref Repeat steps 3 and 4 for each patch. Commit the changes: hg commit --mq -m "Rebase patch"

Credits

Thanks to Thinker Lee for telling me about qqueue and Chris Pearce for explaining to me how he uses mq repos on Bitbucket.

Of course, feel free to leave a comment if I missed anything useful or if there's a easier way to do any of the above.