templatekw: switch manifest template keyword to new API
authorYuya Nishihara <yuya@tcha.org>
Sun, 25 Feb 2018 20:55:53 +0900
changeset 36597 d57f383516f6
parent 36596 b5d39a09656a
child 36598 c3f9d0c303e8
templatekw: switch manifest template keyword to new API
mercurial/templatekw.py
--- a/mercurial/templatekw.py	Sun Feb 25 19:23:06 2018 +0900
+++ b/mercurial/templatekw.py	Sun Feb 25 20:55:53 2018 +0900
@@ -648,18 +648,20 @@
 # teach templater latesttags.changes is switched to (context, mapping) API
 _showchangessincetag._requires = {'repo', 'ctx'}
 
-@templatekeyword('manifest')
-def showmanifest(**args):
-    repo, ctx, templ = args[r'repo'], args[r'ctx'], args[r'templ']
+@templatekeyword('manifest', requires={'repo', 'ctx', 'templ'})
+def showmanifest(context, mapping):
+    repo = context.resource(mapping, 'repo')
+    ctx = context.resource(mapping, 'ctx')
+    templ = context.resource(mapping, 'templ')
     mnode = ctx.manifestnode()
     if mnode is None:
         # just avoid crash, we might want to use the 'ff...' hash in future
         return
     mrev = repo.manifestlog._revlog.rev(mnode)
     mhex = hex(mnode)
-    args = args.copy()
-    args.update({r'rev': mrev, r'node': mhex})
-    f = templ('manifest', **args)
+    mapping = mapping.copy()
+    mapping.update({'rev': mrev, 'node': mhex})
+    f = templ('manifest', **pycompat.strkwargs(mapping))
     # TODO: perhaps 'ctx' should be dropped from mapping because manifest
     # rev and node are completely different from changeset's.
     return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex})