comparison hgext/bugzilla.py @ 3741:0897bf8d54c7

update bugzilla extension to use ui buffers
author Matt Mackall <mpm@selenic.com>
date Fri, 01 Dec 2006 01:29:14 -0600
parents b4ad640a3bcf
children 1e0b94cfba0e
comparison
equal deleted inserted replaced
3740:aef384dbc731 3741:0897bf8d54c7
265 count -= 1 265 count -= 1
266 return root 266 return root
267 267
268 mapfile = self.ui.config('bugzilla', 'style') 268 mapfile = self.ui.config('bugzilla', 'style')
269 tmpl = self.ui.config('bugzilla', 'template') 269 tmpl = self.ui.config('bugzilla', 'template')
270 sio = cmdutil.stringio() 270 t = cmdutil.changeset_templater(self.ui, self.repo,
271 t = cmdutil.changeset_templater(self.ui, self.repo, mapfile, sio) 271 False, None, mapfile, False)
272 if not mapfile and not tmpl: 272 if not mapfile and not tmpl:
273 tmpl = _('changeset {node|short} in repo {root} refers ' 273 tmpl = _('changeset {node|short} in repo {root} refers '
274 'to bug {bug}.\ndetails:\n\t{desc|tabindent}') 274 'to bug {bug}.\ndetails:\n\t{desc|tabindent}')
275 if tmpl: 275 if tmpl:
276 tmpl = templater.parsestring(tmpl, quoted=False) 276 tmpl = templater.parsestring(tmpl, quoted=False)
277 t.use_template(tmpl) 277 t.use_template(tmpl)
278 self.ui.pushbuffer()
278 t.show(changenode=node, changes=changes, 279 t.show(changenode=node, changes=changes,
279 bug=str(bugid), 280 bug=str(bugid),
280 hgweb=self.ui.config('web', 'baseurl'), 281 hgweb=self.ui.config('web', 'baseurl'),
281 root=self.repo.root, 282 root=self.repo.root,
282 webroot=webroot(self.repo.root)) 283 webroot=webroot(self.repo.root))
283 self.add_comment(bugid, sio.getvalue(), templater.email(changes[1])) 284 data = self.ui.popbuffer()
285 self.add_comment(bugid, data, templater.email(changes[1]))
284 286
285 def hook(ui, repo, hooktype, node=None, **kwargs): 287 def hook(ui, repo, hooktype, node=None, **kwargs):
286 '''add comment to bugzilla for each changeset that refers to a 288 '''add comment to bugzilla for each changeset that refers to a
287 bugzilla bug id. only add a comment once per bug, so same change 289 bugzilla bug id. only add a comment once per bug, so same change
288 seen multiple times does not fill bug with duplicate data.''' 290 seen multiple times does not fill bug with duplicate data.'''