Monday, September 20, 2010

Testing patches from Bugzilla

I just started using MQ (Mercurial Queues). Now that I've tried it I can't imagine ever using a mercurial repo without it! I know that sounds a bit cliche, like something out of a commercial, but it's true!

Here's how to test patches from bugzilla. With MQ you can apply the patches, test them and then remove them with ease if you want to revert back to trunk code. Well the main purpose of MQ is to help with code development so that you can write new patches, edit, update, and remove when needed. But there is also times you want to test someone else's patches, for example from a bug on Bugzilla, in this case too MQ can help.

How to test patches using MQ.. (updated 23.09.2010)

- First make sure you have MQ installed. MQ is a Mercurial extension. Make sure you have MQ setup by following the Mozilla MQ guide ( ).

- Now you can use either method 1 or method 2 below to import the patches to MQ..

Mtd 1:

hg qimport -n name-of-patch patch-url
(patch-url will be the atachment url from bugzilla)


A more convenient method is to use the qimportbz extension which will allow you to import patches directly from the Bug#

After setting up qimportbz extension do:

hg qimport bz://xxxxxx
(xxxxxx is the bug number on bugzilla)

When a list of patches is displayed enter the numbers of the patches you want with a space in between. The first patch applied will be named with the bugnumber (you can rename this later in the .hg/patches folder). The qimport extension will attempt to name all the following patches with the same name and give the error..

A patch file named 'bug-xxxxxx.diff' already exists in your patch directory. Rename patch 'abcdef' (yyyyyy) (r)/overwrite (o)?

Hit enter and give a new name for the patch. Continue for all the remaining patches until importing is complete.

-After importing the patch(es)..

hg qpush name-of-patch
(apply the patch to MQ. you can use -a option to apply all the patches at once)

Test the patch(es)

hg qpop
(removes patches from the top of the queue)

For a quick lookat MQ commands see