Need help on Mercurial and Bugzilla integration!

Jim Hague jim.hague at acm.org
Tue Dec 13 14:55:36 UTC 2011


On Friday 09 Dec 2011 02:11:30 Sun Paul wrote:
> I try to make the Mercurial (2.0.1) to work with my existing Bugzilla
> setup. however, I am failed. The hgrc for the local repository is attached
> below for referecnce.
> 
> Everytime, I do a commit, the following error presetned, and I suspected
> the bugzilla extension is not being called to execute.
> 
> [root test01]# hg -v com -m "BZ 686" file
> could not import hgext.hgext.bugzilla (No module named hgext.bugzilla):
> trying        hgext.bugzilla
> file
> committed changeset 57:0c26a22fc01f

There are probably two issues here. First, is the bugzilla extension being 
enabled properly?

All that should be necessary to enable the Bugzilla extension is:

[extensions]
hgext.bugzilla =

If, when you do that,

$ hg help bugzilla

doesn't produce the rather long Bugzilla extension help, you've got some 
packaging or other installation problem. How did you install Mercurial? From 
the RPM?

Second, when you have it enabled, there is the interface with your Bugzilla. 
What version of Bugzilla are you using?

> [bugzilla]
> host = 127.0.0.1
> db = bugs
> password = db
> version = 3.0
> strip = 4
> bzuser = db at 1.0.0.127
> hgweb = http://127.0.0.1
> bzdir = /var/www/html/bugzilla
> template = Changeset {node|short}, made by {author} in the {webroot} repos,
> refers to this bug.\n
>  For complete details, see
>  {hgweb}{webroot}?cmd=changeset;node={node|short}\n
>  Changeset Description:\n
>  \t{desc|tabindent}
> 
> [usermap] hguser=bugzilla.user at domain.com

First off, you're using direct access to Bugzilla's MySQL database. This is the 
default for historical reasons, but I don't recommend it. It's horribly 
vulnerable to database schema changes. Provided your Bugzilla is 3.4 or later, 
I really recommend using one of the XMLRPC based access methods instead. 
Configuration for the basic XMLRPC method is easier too.

bzurl=<Bugzilla site URL, e.g. http://localhost/bugzilla>
user=<Bugzilla user ID>
password=<Bugzilla user password>
version=xmlrpc

strip= and template= as before. The Bugzilla user must have the rights to post 
comments to all affected bugs.

Finally, unless you specified a different regexp, the default regexp will not 
match the "BZ 686" comment in your sample commit. So it will not find any bug 
reference in the comment, and so won't attempt to modify Bugzilla. Try a 
commit with the comment "Test Bug 686" instead.

HTH.
-- 
Jim Hague - jim.hague at acm.org          Never trust a computer you can't lift.



More information about the Mercurial mailing list