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