# HG changeset patch # User Vadim Gelfer # Date 1147100686 25200 # Node ID ec82cff7d2c4731f46a8ec5467d1136503bef0d2 # Parent afe24f5b7a9e5fe36ed12228a085427f655791b7# Parent f72c438ce08cb1f8ca3bae754d5ebd92c81ab783 merge with crew. diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py --- a/hgext/bugzilla.py +++ b/hgext/bugzilla.py @@ -45,10 +45,7 @@ from mercurial.i18n import gettext as _ from mercurial.node import * demandload(globals(), 'mercurial:templater,util os re time') -try: - import MySQLdb -except ImportError: - raise util.Abort(_('python mysql support not available')) +MySQLdb = None def buglist(ids): return '(' + ','.join(map(str, ids)) + ')' @@ -262,6 +259,13 @@ def hook(ui, repo, hooktype, node=None, '''add comment to bugzilla for each changeset that refers to a bugzilla bug id. only add a comment once per bug, so same change seen multiple times does not fill bug with duplicate data.''' + try: + import MySQLdb as mysql + global MySQLdb + MySQLdb = mysql + except ImportError, err: + raise util.Abort(_('python mysql support not available: %s') % err) + if node is None: raise util.Abort(_('hook type %s does not pass a changeset id') % hooktype)