[PATCH 4 of 5] templater: use named function to named template against mapping dict (API)

Martin von Zweigbergk martinvonz at google.com
Sun Mar 18 01:45:30 EDT 2018


On Sat, Mar 17, 2018 at 9:39 PM Yuya Nishihara <yuya at tcha.org> wrote:

> diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
> --- a/mercurial/hgweb/webutil.py
> +++ b/mercurial/hgweb/webutil.py
> @@ -243,12 +243,18 @@ def nodebranchnodefault(ctx):
>      return branches
>
>  def showtag(repo, tmpl, t1, node=nullid, **args):
> +    args = pycompat.byteskwargs(args)
>      for t in repo.nodetags(node):
> -        yield tmpl(t1, tag=t, **args)
> +        lm = args.copy()
>

Do we need to make a copy every time?

+        lm['tag'] = t
> +        yield tmpl.generate(t1, lm)
>
>  def showbookmark(repo, tmpl, t1, node=nullid, **args):
> +    args = pycompat.byteskwargs(args)
>      for t in repo.nodebookmarks(node):
> -        yield tmpl(t1, bookmark=t, **args)
> +        lm = args.copy()
>

Here too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180318/afd2346f/attachment.html>


More information about the Mercurial-devel mailing list