# HG changeset patch # User Yuya Nishihara # Date 1521253384 -32400 # Node ID 317382151ac38e5a265d303c278f45bc022fc95b # Parent 4b744c7b35ceeec1912f6ff2dea32d67d5de39da templater: rename .render(mapping) to .renderdefault(mapping) (API) I'm going to add templ.render(t, mapping) and templ.generate(t, mapping) in place of stringify(templ(t, **mapping)) and templ(t, **mapping) respectively. .. api:: The ``render(mapping)`` method of the templater has been renamed to ``renderdefault(mapping)``. diff -r 4b744c7b35ce -r 317382151ac3 hgext/show.py --- a/hgext/show.py Sat Mar 17 15:22:14 2018 +0900 +++ b/hgext/show.py Sat Mar 17 11:23:04 2018 +0900 @@ -260,7 +260,7 @@ shortesttmpl = formatter.maketemplater(ui, '{shortest(node, %d)}' % nodelen, resources=tres) def shortest(ctx): - return shortesttmpl.render({'ctx': ctx, 'node': ctx.hex()}) + return shortesttmpl.renderdefault({'ctx': ctx, 'node': ctx.hex()}) # We write out new heads to aid in DAG awareness and to help with decision # making on how the stack should be reconciled with commits made since the diff -r 4b744c7b35ce -r 317382151ac3 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sat Mar 17 15:22:14 2018 +0900 +++ b/mercurial/cmdutil.py Sat Mar 17 11:23:04 2018 +0900 @@ -907,7 +907,7 @@ mapping = {'ctx': ctx, 'revcache': {}} if props: mapping.update(props) - return t.render(mapping) + return t.renderdefault(mapping) def _buildfntemplate(pat, total=None, seqno=None, revwidth=None, pathname=None): r"""Convert old-style filename format string to template string diff -r 4b744c7b35ce -r 317382151ac3 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Sat Mar 17 15:22:14 2018 +0900 +++ b/mercurial/debugcommands.py Sat Mar 17 11:23:04 2018 +0900 @@ -2455,7 +2455,7 @@ if revs is None: tres = formatter.templateresources(ui, repo) t = formatter.maketemplater(ui, tmpl, resources=tres) - ui.write(t.render(props)) + ui.write(t.renderdefault(props)) else: displayer = logcmdutil.maketemplater(ui, repo, tmpl) for r in revs: diff -r 4b744c7b35ce -r 317382151ac3 mercurial/filemerge.py --- a/mercurial/filemerge.py Sat Mar 17 15:22:14 2018 +0900 +++ b/mercurial/filemerge.py Sat Mar 17 11:23:04 2018 +0900 @@ -563,7 +563,7 @@ ctx = ctx.p1() props = {'ctx': ctx} - templateresult = template.render(props) + templateresult = template.renderdefault(props) label = ('%s:' % label).ljust(pad + 1) mark = '%s %s' % (label, templateresult) diff -r 4b744c7b35ce -r 317382151ac3 mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Sat Mar 17 15:22:14 2018 +0900 +++ b/mercurial/logcmdutil.py Sat Mar 17 11:23:04 2018 +0900 @@ -285,7 +285,7 @@ t = formatter.maketemplater(self.repo.ui, '{join(obsfate, "\n")}', defaults=templatekw.keywords, resources=tres) - obsfate = t.render({'ctx': ctx, 'revcache': {}}).splitlines() + obsfate = t.renderdefault({'ctx': ctx, 'revcache': {}}).splitlines() if obsfate: for obsfateline in obsfate: @@ -858,7 +858,7 @@ resources=tres) def formatnode(repo, ctx): props = {'ctx': ctx, 'repo': repo, 'revcache': {}} - return templ.render(props) + return templ.renderdefault(props) return formatnode def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, props=None): diff -r 4b744c7b35ce -r 317382151ac3 mercurial/templater.py --- a/mercurial/templater.py Sat Mar 17 15:22:14 2018 +0900 +++ b/mercurial/templater.py Sat Mar 17 11:23:04 2018 +0900 @@ -723,7 +723,7 @@ raise IOError(inst.args[0], encoding.strfromlocal(reason)) return self.cache[t] - def render(self, mapping): + def renderdefault(self, mapping): """Render the default unnamed template and return result as string""" mapping = pycompat.strkwargs(mapping) return templateutil.stringify(self('', **mapping))