##// END OF EJS Templates
hgweb: mark all lambda template keywords as new-style function...
Yuya Nishihara -
r38965:d7e6e109 default
parent child Browse files
Show More
@@ -408,6 +408,12 b' def whyunstable(context, mapping):'
408
408
409 whyunstable._requires = {'repo', 'ctx'}
409 whyunstable._requires = {'repo', 'ctx'}
410
410
411 # helper to mark a function as a new-style template keyword; can be removed
412 # once old-style function gets unsupported and new-style becomes the default
413 def _kwfunc(f):
414 f._requires = ()
415 return f
416
411 def commonentry(repo, ctx):
417 def commonentry(repo, ctx):
412 node = ctx.node()
418 node = ctx.node()
413 return {
419 return {
@@ -432,8 +438,8 b' def commonentry(repo, ctx):'
432 'branches': nodebranchdict(repo, ctx),
438 'branches': nodebranchdict(repo, ctx),
433 'tags': nodetagsdict(repo, node),
439 'tags': nodetagsdict(repo, node),
434 'bookmarks': nodebookmarksdict(repo, node),
440 'bookmarks': nodebookmarksdict(repo, node),
435 'parent': lambda **x: parents(ctx),
441 'parent': _kwfunc(lambda context, mapping: parents(ctx)),
436 'child': lambda **x: children(ctx),
442 'child': _kwfunc(lambda context, mapping: children(ctx)),
437 }
443 }
438
444
439 def changelistentry(web, ctx):
445 def changelistentry(web, ctx):
@@ -450,9 +456,9 b' def changelistentry(web, ctx):'
450
456
451 entry = commonentry(repo, ctx)
457 entry = commonentry(repo, ctx)
452 entry.update(
458 entry.update(
453 allparents=lambda **x: parents(ctx),
459 allparents=_kwfunc(lambda context, mapping: parents(ctx)),
454 parent=lambda **x: parents(ctx, rev - 1),
460 parent=_kwfunc(lambda context, mapping: parents(ctx, rev - 1)),
455 child=lambda **x: children(ctx, rev + 1),
461 child=_kwfunc(lambda context, mapping: children(ctx, rev + 1)),
456 changelogtag=showtags,
462 changelogtag=showtags,
457 files=files,
463 files=files,
458 )
464 )
@@ -521,7 +527,7 b' def changesetentry(web, ctx):'
521 changesetbranch=showbranch,
527 changesetbranch=showbranch,
522 files=templateutil.mappedgenerator(_listfilesgen,
528 files=templateutil.mappedgenerator(_listfilesgen,
523 args=(ctx, web.stripecount)),
529 args=(ctx, web.stripecount)),
524 diffsummary=lambda **x: diffsummary(diffstatsgen),
530 diffsummary=_kwfunc(lambda context, mapping: diffsummary(diffstatsgen)),
525 diffstat=diffstats,
531 diffstat=diffstats,
526 archives=web.archivelist(ctx.hex()),
532 archives=web.archivelist(ctx.hex()),
527 **pycompat.strkwargs(commonentry(web.repo, ctx)))
533 **pycompat.strkwargs(commonentry(web.repo, ctx)))
General Comments 0
You need to be logged in to leave comments. Login now