templatekw: switch revset() to new API
authorYuya Nishihara <yuya@tcha.org>
Sun, 25 Feb 2018 19:08:02 +0900
changeset 36595 2da414105809
parent 36594 59ee648870a7
child 36596 b5d39a09656a
templatekw: switch revset() to new API
mercurial/templatekw.py
mercurial/templater.py
--- a/mercurial/templatekw.py	Sun Feb 25 19:05:57 2018 +0900
+++ b/mercurial/templatekw.py	Sun Feb 25 19:08:02 2018 +0900
@@ -903,12 +903,12 @@
     ctx = context.resource(mapping, 'ctx')
     return scmutil.intrev(ctx)
 
-def showrevslist(name, revs, **args):
+def showrevslist(context, mapping, name, revs):
     """helper to generate a list of revisions in which a mapped template will
     be evaluated"""
-    args = pycompat.byteskwargs(args)
-    repo = args['ctx'].repo()
-    f = _showlist(name, ['%d' % r for r in revs], args['templ'], args)
+    repo = context.resource(mapping, 'repo')
+    templ = context.resource(mapping, 'templ')
+    f = _showlist(name, ['%d' % r for r in revs], templ, mapping)
     return _hybrid(f, revs,
                    lambda x: {name: x, 'ctx': repo[x], 'revcache': {}},
                    pycompat.identity, keytype=int)
--- a/mercurial/templater.py	Sun Feb 25 19:05:57 2018 +0900
+++ b/mercurial/templater.py	Sun Feb 25 19:08:02 2018 +0900
@@ -1129,12 +1129,7 @@
             revs = query(raw)
             revs = list(revs)
             revsetcache[raw] = revs
-
-    # TODO: pass (context, mapping) pair to keyword function
-    props = context._resources.copy()
-    props.update(mapping)
-    return templatekw.showrevslist("revision", revs,
-                                   **pycompat.strkwargs(props))
+    return templatekw.showrevslist(context, mapping, "revision", revs)
 
 @templatefunc('rstdoc(text, style)')
 def rstdoc(context, mapping, args):