diff mercurial/templatekw.py @ 44597:fc1fa3a07af6

templater: introduce wrapper for smartset (API) I want to add a template function which takes a revset as an argument: {somefunc(..., revset(...))} ^^^^^^^^^^^ evaluates to a revslist This wrapper will provide a method to get an underlying smartset. It should also be good for performance since count(revset(...)) will no longer have to fully consume the smartset for example, but that isn't the point of this change.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 15 Mar 2020 15:12:44 +0900
parents 14d0e89520a2
children a825bfbf6642
line wrap: on
line diff
--- a/mercurial/templatekw.py	Fri Mar 20 23:30:23 2020 -0400
+++ b/mercurial/templatekw.py	Sun Mar 15 15:12:44 2020 +0900
@@ -873,24 +873,6 @@
     return scmutil.intrev(ctx)
 
 
-def showrevslist(context, mapping, name, revs):
-    """helper to generate a list of revisions in which a mapped template will
-    be evaluated"""
-    repo = context.resource(mapping, b'repo')
-    # revs may be a smartset; don't compute it until f() has to be evaluated
-    def f():
-        srevs = [b'%d' % r for r in revs]
-        return _showcompatlist(context, mapping, name, srevs)
-
-    return _hybrid(
-        f,
-        revs,
-        lambda x: {name: x, b'ctx': repo[x]},
-        pycompat.identity,
-        keytype=int,
-    )
-
-
 @templatekeyword(b'subrepos', requires={b'ctx'})
 def showsubrepos(context, mapping):
     """List of strings. Updated subrepositories in the changeset."""