Sunday, July 6, 2008

Bugzilla integration with Mercurial

We are using Mercurial at work. We are also using Bugzilla. Unfortunately we are not using Bugzilla 2.16 which is the version of Bugzilla that hg ships an integration hook with. So I modified the hook to work with the version of Bugzilla that we are using (3.1.4+ cvs trunk from someday in the past couple months). The script can now be found in my personal hg repo. It should work with any Bugzilla installation that comes with the email_in.pl script (since 3.0 maybe?).

Please do tell me what you think of it. It is the first Python script I've really done anything with (I'm more a Perl kind of guy). As always, feel free to do whatever you want with it (respecting the license of the original author of course). I'd love to see it get integrated back into Mercurial, but as I have made no real effort to test any of it (it works for me, but no promises and all that) I don't expect that any time soon. Perhaps someone at Mozilla would take the time to do that; this is probably useful for integrating mozilla-central with bmo.

Edit: link updated (should have pointed to tip in the first place). I've fixed both the syntax errors (a right parenthesis was in the wrong place, I must have copied it off the server incorrectly, because I swear I fixed the syntax errors that were there when it was on the server, but copying files out of nano over ajaxterm isn't exactly the easiest thing to do; while updating this, I realized that I could do a wget to get this file from my repo, so I can actually test the version at the above url. Rest assured it works this time). Thank you very much geraldfauvelle for noticing that it was broken.

3 comments:

geraldfauvelle said...

I tried your extension, with Mercurial 1.0.1 and Bugzilla 3.0.4, but when I run hg, it cannot load bugzilla.py :

*** failed to import extension hgext.bugzilla from /etc/mercurial/bugzilla.py: invalid syntax (bugzilla.py, line 150)

Any idea of what could be the problem ?

fallout said...

Yeah, there was a syntax error on that line (an extra rparen). It is fixed now. Thank you for finding it (and for trying to use it in general).

geraldfauvelle said...

ok, I workeda bit on that python file, I fixed the error. But now I don't see how to make it work. I mean I configure as said in the file, I commit a change with a comment "fix for bug 2" for instance, but I don't see anything in bug history and don't get any mail. Is there a log or a debug mode to see what's happening ?