hg qimport my-bugzilla-patch

written 15 Aug 2008
Since I'm only a few days away from the end of my internship, I can't really start any large projects so I went looking for little projects I can get done. This one originated from my dislike of pushing patches from bugzilla. My steps so far have been to go to the bug, find the attachment, download it, import it into my mozilla-central patch queue and then qpush, qrm and push. Well that's a small hassle. So today I decided to write a small python script to help me out (I would have made it an hg extension but I can't build hg on my system due to compiler issues with python's extension API). So here's my script. Usage is pretty simple: qimportbz.py 418454 This will fetch bugzilla's xml output for bug 418454, look for patches that are not obsolete, and let you pick which ones to import. It conveniently displays the patch description and any review flags. If there's only one, it'll pick it automatically. It then takes the patch and feeds it into hg qimport, automatically generating a patch name from the bug and attachment name. I plan to extend this further to automatically generate a commit message and user (preserving any already in the patch), display more flags (like approval) and automatically upgrade to newer versions of the patch posted in the bug.