[PATCH 08 of 10] templatekw: switch manifest template keyword to new API

Yuya Nishihara yuya at tcha.org
Thu Mar 1 20:51:58 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1519559753 -32400
#      Sun Feb 25 20:55:53 2018 +0900
# Node ID 852829295891f2decb6132113f1f1d437c376f6a
# Parent  69d82c25f62751f65cbc40f225f7a1b3f5326a1f
templatekw: switch manifest template keyword to new API

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -646,18 +646,20 @@ def _showchangessincetag(context, mappin
 # teach templater latesttags.changes is switched to (context, mapping) API
 _showchangessincetag._requires = {'repo', 'ctx'}
 
- at templatekeyword('manifest')
-def showmanifest(**args):
-    repo, ctx, templ = args[r'repo'], args[r'ctx'], args[r'templ']
+ at 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})


More information about the Mercurial-devel mailing list