bzexport: a Mercurial extension

September 7th, 2010

Last week I managed to find myself a little bit of time for a project I had been meaning to get to: bzexport. bzexport is a Mercurial extension that allows you to attach patches from your Mercurial patch queue to bugzilla from the Mercurial command line. It’s the obvious companion to the qimportbz extension. You can read the README for details on installing and using the extension, but the short form is:

hg bzexport [REV] [BUG]

where REV is the name of a currently applied patch from your queue, and BUG is a bug number to attach it to. Of course, the extension is smarter than just that, and if you leave off those parameters it will default to working on the topmost patch in your queue, and it will attempt to deduce the bug number from the commit message in the patch. (Standard notation used at Mozilla should work, i.e. “bug 12345 – some text”, “b=12345 some text” etc.)

bzexport attempts to be clever and borrow your Bugzilla login cookies from your default Firefox profile so that you don’t have to provide authentication details. This does not currently work on the Mercurial shipped with MozillaBuild, so you’ll have to provide your username and password in your .hgrc as described in the README if you intend to use it under MozillaBuild’s hg.

bzexport relies on Gerv‘s excellent BzAPI, so hats off to Gerv for that! Also, patches for additional functionality are welcome.

Comments are closed.