Show More
@@ -145,7 +145,7 b' from mercurial.node import short' | |||
|
145 | 145 | from mercurial import cmdutil, templater, util |
|
146 | 146 | import re, time |
|
147 | 147 | |
|
148 |
|
|
|
148 | mysqldb = None | |
|
149 | 149 | |
|
150 | 150 | def buglist(ids): |
|
151 | 151 | return '(' + ','.join(map(str, ids)) + ')' |
@@ -165,7 +165,7 b' class bugzilla_2_16(object):' | |||
|
165 | 165 | self.ui.readconfig(usermap, sections=['usermap']) |
|
166 | 166 | self.ui.note(_('connecting to %s:%s as %s, password %s\n') % |
|
167 | 167 | (host, db, user, '*' * len(passwd))) |
|
168 |
self.conn = |
|
|
168 | self.conn = mysqldb.connect(host=host, user=user, passwd=passwd, | |
|
169 | 169 | db=db, connect_timeout=timeout) |
|
170 | 170 | self.cursor = self.conn.cursor() |
|
171 | 171 | self.longdesc_id = self.get_longdesc_id() |
@@ -177,7 +177,7 b' class bugzilla_2_16(object):' | |||
|
177 | 177 | self.ui.note(_('query: %s %s\n') % (args, kwargs)) |
|
178 | 178 | try: |
|
179 | 179 | self.cursor.execute(*args, **kwargs) |
|
180 |
except |
|
|
180 | except mysqldb.MySQLError: | |
|
181 | 181 | self.ui.note(_('failed query: %s %s\n') % (args, kwargs)) |
|
182 | 182 | raise |
|
183 | 183 | |
@@ -419,9 +419,9 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
419 | 419 | bugzilla bug id. only add a comment once per bug, so same change |
|
420 | 420 | seen multiple times does not fill bug with duplicate data.''' |
|
421 | 421 | try: |
|
422 |
import |
|
|
423 |
global |
|
|
424 |
|
|
|
422 | import mysqldb as mysql | |
|
423 | global mysqldb | |
|
424 | mysqldb = mysql | |
|
425 | 425 | except ImportError, err: |
|
426 | 426 | raise util.Abort(_('python mysql support not available: %s') % err) |
|
427 | 427 | |
@@ -436,6 +436,6 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
436 | 436 | for id in ids: |
|
437 | 437 | bz.update(id, ctx) |
|
438 | 438 | bz.notify(ids, util.email(ctx.user())) |
|
439 |
except |
|
|
439 | except mysqldb.MySQLError, err: | |
|
440 | 440 | raise util.Abort(_('database error: %s') % err[1]) |
|
441 | 441 |
General Comments 0
You need to be logged in to leave comments.
Login now