Mercurial > hg
changeset 38929:d7e6e109eaae
hgweb: mark all lambda template keywords as new-style function
This is just a temporary workaround, and will be removed in Mercurial 4.9.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 28 Jul 2018 21:19:24 +0900 |
parents | 4167437a45dd |
children | 382b055cc358 |
files | mercurial/hgweb/webutil.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py Sat Jul 28 21:02:05 2018 +0900 +++ b/mercurial/hgweb/webutil.py Sat Jul 28 21:19:24 2018 +0900 @@ -408,6 +408,12 @@ whyunstable._requires = {'repo', 'ctx'} +# helper to mark a function as a new-style template keyword; can be removed +# once old-style function gets unsupported and new-style becomes the default +def _kwfunc(f): + f._requires = () + return f + def commonentry(repo, ctx): node = ctx.node() return { @@ -432,8 +438,8 @@ 'branches': nodebranchdict(repo, ctx), 'tags': nodetagsdict(repo, node), 'bookmarks': nodebookmarksdict(repo, node), - 'parent': lambda **x: parents(ctx), - 'child': lambda **x: children(ctx), + 'parent': _kwfunc(lambda context, mapping: parents(ctx)), + 'child': _kwfunc(lambda context, mapping: children(ctx)), } def changelistentry(web, ctx): @@ -450,9 +456,9 @@ entry = commonentry(repo, ctx) entry.update( - allparents=lambda **x: parents(ctx), - parent=lambda **x: parents(ctx, rev - 1), - child=lambda **x: children(ctx, rev + 1), + allparents=_kwfunc(lambda context, mapping: parents(ctx)), + parent=_kwfunc(lambda context, mapping: parents(ctx, rev - 1)), + child=_kwfunc(lambda context, mapping: children(ctx, rev + 1)), changelogtag=showtags, files=files, ) @@ -521,7 +527,7 @@ changesetbranch=showbranch, files=templateutil.mappedgenerator(_listfilesgen, args=(ctx, web.stripecount)), - diffsummary=lambda **x: diffsummary(diffstatsgen), + diffsummary=_kwfunc(lambda context, mapping: diffsummary(diffstatsgen)), diffstat=diffstats, archives=web.archivelist(ctx.hex()), **pycompat.strkwargs(commonentry(web.repo, ctx)))