##// END OF EJS Templates
only import mysql module if hook used.
Vadim Gelfer -
r2218:afe24f5b default
parent child Browse files
Show More
@@ -44,10 +44,7 from mercurial.i18n import gettext as _
44 44 from mercurial.node import *
45 45 demandload(globals(), 'cStringIO mercurial:templater,util os re time')
46 46
47 try:
48 import MySQLdb
49 except ImportError:
50 raise util.Abort(_('python mysql support not available'))
47 MySQLdb = None
51 48
52 49 def buglist(ids):
53 50 return '(' + ','.join(map(str, ids)) + ')'
@@ -275,6 +272,13 def hook(ui, repo, hooktype, node=None,
275 272 '''add comment to bugzilla for each changeset that refers to a
276 273 bugzilla bug id. only add a comment once per bug, so same change
277 274 seen multiple times does not fill bug with duplicate data.'''
275 try:
276 import MySQLdb as mysql
277 global MySQLdb
278 MySQLdb = mysql
279 except ImportError, err:
280 raise util.Abort(_('python mysql support not available: %s') % err)
281
278 282 if node is None:
279 283 raise util.Abort(_('hook type %s does not pass a changeset id') %
280 284 hooktype)
General Comments 0
You need to be logged in to leave comments. Login now