##// END OF EJS Templates
templatekw: switch manifest template keyword to new API
Yuya Nishihara -
r36615:d57f3835 default
parent child Browse files
Show More
@@ -648,18 +648,20 def _showchangessincetag(context, mappin
648 # teach templater latesttags.changes is switched to (context, mapping) API
648 # teach templater latesttags.changes is switched to (context, mapping) API
649 _showchangessincetag._requires = {'repo', 'ctx'}
649 _showchangessincetag._requires = {'repo', 'ctx'}
650
650
651 @templatekeyword('manifest')
651 @templatekeyword('manifest', requires={'repo', 'ctx', 'templ'})
652 def showmanifest(**args):
652 def showmanifest(context, mapping):
653 repo, ctx, templ = args[r'repo'], args[r'ctx'], args[r'templ']
653 repo = context.resource(mapping, 'repo')
654 ctx = context.resource(mapping, 'ctx')
655 templ = context.resource(mapping, 'templ')
654 mnode = ctx.manifestnode()
656 mnode = ctx.manifestnode()
655 if mnode is None:
657 if mnode is None:
656 # just avoid crash, we might want to use the 'ff...' hash in future
658 # just avoid crash, we might want to use the 'ff...' hash in future
657 return
659 return
658 mrev = repo.manifestlog._revlog.rev(mnode)
660 mrev = repo.manifestlog._revlog.rev(mnode)
659 mhex = hex(mnode)
661 mhex = hex(mnode)
660 args = args.copy()
662 mapping = mapping.copy()
661 args.update({r'rev': mrev, r'node': mhex})
663 mapping.update({'rev': mrev, 'node': mhex})
662 f = templ('manifest', **args)
664 f = templ('manifest', **pycompat.strkwargs(mapping))
663 # TODO: perhaps 'ctx' should be dropped from mapping because manifest
665 # TODO: perhaps 'ctx' should be dropped from mapping because manifest
664 # rev and node are completely different from changeset's.
666 # rev and node are completely different from changeset's.
665 return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex})
667 return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex})
General Comments 0
You need to be logged in to leave comments. Login now