Mercurial > hg > gitserve
changeset 2218:afe24f5b7a9e
only import mysql module if hook used.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Wed, 03 May 2006 14:56:07 -0700 |
parents | 2be3ac7abc21 |
children | ec82cff7d2c4 |
files | hgext/bugzilla.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bugzilla.py Wed May 03 14:40:39 2006 -0700 +++ b/hgext/bugzilla.py Wed May 03 14:56:07 2006 -0700 @@ -44,10 +44,7 @@ from mercurial.node import * demandload(globals(), 'cStringIO 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)) + ')' @@ -275,6 +272,13 @@ '''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)