##// 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 from mercurial.node import *
44 from mercurial.node import *
45 demandload(globals(), 'cStringIO mercurial:templater,util os re time')
45 demandload(globals(), 'cStringIO mercurial:templater,util os re time')
46
46
47 try:
47 MySQLdb = None
48 import MySQLdb
49 except ImportError:
50 raise util.Abort(_('python mysql support not available'))
51
48
52 def buglist(ids):
49 def buglist(ids):
53 return '(' + ','.join(map(str, ids)) + ')'
50 return '(' + ','.join(map(str, ids)) + ')'
@@ -275,6 +272,13 def hook(ui, repo, hooktype, node=None,
275 '''add comment to bugzilla for each changeset that refers to a
272 '''add comment to bugzilla for each changeset that refers to a
276 bugzilla bug id. only add a comment once per bug, so same change
273 bugzilla bug id. only add a comment once per bug, so same change
277 seen multiple times does not fill bug with duplicate data.'''
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 if node is None:
282 if node is None:
279 raise util.Abort(_('hook type %s does not pass a changeset id') %
283 raise util.Abort(_('hook type %s does not pass a changeset id') %
280 hooktype)
284 hooktype)
General Comments 0
You need to be logged in to leave comments. Login now