Mercurial > hg-stable
changeset 20667:e96e9f805c19
changeset_templater: remove use_template method
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 08 Mar 2014 16:14:08 -0600 |
parents | e3eb480a9391 |
children | 3a35ba2681ec |
files | hgext/bugzilla.py hgext/churn.py hgext/hgcia.py hgext/keyword.py hgext/notify.py mercurial/cmdutil.py |
diffstat | 6 files changed, 14 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bugzilla.py Sat Mar 08 16:01:58 2014 -0600 +++ b/hgext/bugzilla.py Sat Mar 08 16:14:08 2014 -0600 @@ -879,14 +879,13 @@ mapfile = self.ui.config('bugzilla', 'style') tmpl = self.ui.config('bugzilla', 'template') - t = cmdutil.changeset_templater(self.ui, self.repo, - False, None, mapfile, False) if not mapfile and not tmpl: tmpl = _('changeset {node|short} in repo {root} refers ' 'to bug {bug}.\ndetails:\n\t{desc|tabindent}') if tmpl: tmpl = templater.parsestring(tmpl, quoted=False) - t.use_template(tmpl) + t = cmdutil.changeset_templater(self.ui, self.repo, + False, None, tmpl, mapfile, False) self.ui.pushbuffer() t.show(ctx, changes=ctx.changeset(), bug=str(bugid),
--- a/hgext/churn.py Sat Mar 08 16:01:58 2014 -0600 +++ b/hgext/churn.py Sat Mar 08 16:14:08 2014 -0600 @@ -18,10 +18,10 @@ def maketemplater(ui, repo, tmpl): tmpl = templater.parsestring(tmpl, quoted=False) try: - t = cmdutil.changeset_templater(ui, repo, False, None, None, False) + t = cmdutil.changeset_templater(ui, repo, False, None, tmpl, + None, False) except SyntaxError, inst: raise util.Abort(inst.args[0]) - t.use_template(tmpl) return t def changedlines(ui, repo, ctx1, ctx2, fns):
--- a/hgext/hgcia.py Sat Mar 08 16:01:58 2014 -0600 +++ b/hgext/hgcia.py Sat Mar 08 16:14:08 2014 -0600 @@ -202,8 +202,7 @@ template = self.diffstat and self.dstemplate or self.deftemplate template = templater.parsestring(template, quoted=False) t = cmdutil.changeset_templater(self.ui, self.repo, False, None, - style, False) - t.use_template(template) + template, style, False) self.templater = t def strip(self, path):
--- a/hgext/keyword.py Sat Mar 08 16:01:58 2014 -0600 +++ b/hgext/keyword.py Sat Mar 08 16:14:08 2014 -0600 @@ -218,9 +218,8 @@ '''Replaces keywords in data with expanded template.''' def kwsub(mobj): kw = mobj.group(1) - ct = cmdutil.changeset_templater(self.ui, self.repo, - False, None, '', False) - ct.use_template(self.templates[kw]) + ct = cmdutil.changeset_templater(self.ui, self.repo, False, None + self.templates[kw], '', False) self.ui.pushbuffer() ct.show(ctx, root=self.repo.root, file=path) ekw = templatefilters.firstline(self.ui.popbuffer())
--- a/hgext/notify.py Sat Mar 08 16:01:58 2014 -0600 +++ b/hgext/notify.py Sat Mar 08 16:14:08 2014 -0600 @@ -188,13 +188,12 @@ mapfile = self.ui.config('notify', 'style') template = (self.ui.config('notify', hooktype) or self.ui.config('notify', 'template')) - self.t = cmdutil.changeset_templater(self.ui, self.repo, - False, None, mapfile, False) if not mapfile and not template: template = deftemplates.get(hooktype) or single_template if template: template = templater.parsestring(template, quoted=False) - self.t.use_template(template) + self.t = cmdutil.changeset_templater(self.ui, self.repo, False, None, + template, mapfile, False) def strip(self, path): '''strip leading slashes from local path, turn into web-safe path.'''
--- a/mercurial/cmdutil.py Sat Mar 08 16:01:58 2014 -0600 +++ b/mercurial/cmdutil.py Sat Mar 08 16:14:08 2014 -0600 @@ -948,7 +948,7 @@ class changeset_templater(changeset_printer): '''format changeset information.''' - def __init__(self, ui, repo, patch, diffopts, mapfile, buffered): + def __init__(self, ui, repo, patch, diffopts, tmpl, mapfile, buffered): changeset_printer.__init__(self, ui, repo, patch, diffopts, buffered) formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12]) defaulttempl = { @@ -961,11 +961,10 @@ defaulttempl['filecopy'] = defaulttempl['file_copy'] self.t = templater.templater(mapfile, {'formatnode': formatnode}, cache=defaulttempl) - self.cache = {} + if tmpl: + self.t.cache['changeset'] = tmpl - def use_template(self, t): - '''set template string to use''' - self.t.cache['changeset'] = t + self.cache = {} def _meaningful_parentrevs(self, ctx): """Return list of meaningful (or all if debug) parentrevs for rev. @@ -1096,11 +1095,9 @@ return changeset_printer(ui, repo, patch, opts, buffered) try: - t = changeset_templater(ui, repo, patch, opts, mapfile, buffered) + t = changeset_templater(ui, repo, patch, opts, tmpl, mapfile, buffered) except SyntaxError, inst: raise util.Abort(inst.args[0]) - if tmpl: - t.use_template(tmpl) return t def showmarker(ui, marker):