diff mercurial/templatekw.py @ 37019:c97b936d8bb5

templater: use named function to expand template against mapping dict (API) And replace __call__(t, **mapping) in favor of generate(t, mapping). I prefer a named function here since the templater isn't a simple function-like object. .. api:: The templater is no longer callable. Use ``templater.generate(t, mapping)`` instead of ``templater(t, **pycompat.strkwargs(mapping))``.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 16 Mar 2018 21:39:32 +0900
parents 32f9b7e3f056
children aa97e06a1912
line wrap: on
line diff
--- a/mercurial/templatekw.py	Mon Mar 19 21:09:23 2018 +0900
+++ b/mercurial/templatekw.py	Fri Mar 16 21:39:32 2018 +0900
@@ -478,7 +478,7 @@
     mhex = hex(mnode)
     mapping = mapping.copy()
     mapping.update({'rev': mrev, 'node': mhex})
-    f = templ('manifest', **pycompat.strkwargs(mapping))
+    f = templ.generate('manifest', 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})