One of the development techniques we’re experimenting with for Mozilla2 is the use of Mercurial Queues (MQ). Queues are a way of maintaining a set of patches on top of a base repository.
There are a few features of MQ that have made it very useful:
- You can merge a stack of patches with changes in the underlying repository, instead of ending up with patches that don’t apply and .rej files. The magic you are looking for is hg qsave -e -c; hg qpush -m.
- Patches can be versioned: you can create a mercurial repository of patches, commit and push that repository to share patches between developers.
- Patches can be reordered, folded together, and with some special tricks even split apart into multiple patches.
MQ is ideal for doing large coding experiments such as XPCOMGC: it can keep track of manual rewriting and automatic patches separately; patches can be saved for review and merging upstream without delaying coding work; and the patch repository can be shared between the team doing the work.
The XPCOMGC patch repository is available publicly at http://hg.mozilla.org/users/bsmedberg_mozilla.com/xpcomgc-patches/. The patches are against the ActionMonkey tree… please don’t expect much more than “it builds” yet… the browser won’t start yet, due to various unrooted objects, bad assumptions, and other undiagnosed problems.
Caution: To use MQ effectively, you must set the following settings in your ~/.hgrc:
[extensions] hgext.mq = [diff] git = 1
You must turn on git-style patches, or bad things will happen if you try to add/remove/move files!