diff mercurial/templateutil.py @ 44591:1f81f680912f

templater: remember cache key of evaluated revset This provides a hint for caching further computation result of the given revset. See the next patch for example.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 15 Mar 2020 16:00:45 +0900
parents e3e44e6e7245
children d4ba4d51f85f
line wrap: on
line diff
--- a/mercurial/templateutil.py	Sun Mar 15 22:01:38 2020 +0900
+++ b/mercurial/templateutil.py	Sun Mar 15 16:00:45 2020 +0900
@@ -414,13 +414,18 @@
 
     If name specified, the revs will be rendered with the old-style list
     template of the given name by default.
+
+    The cachekey provides a hint to cache further computation on this
+    smartset. If the underlying smartset is dynamically created, the cachekey
+    should be None.
     """
 
-    def __init__(self, repo, revs, name=None):
+    def __init__(self, repo, revs, name=None, cachekey=None):
         assert isinstance(revs, smartset.abstractsmartset)
         self._repo = repo
         self._revs = revs
         self._name = name
+        self.cachekey = cachekey
 
     def contains(self, context, mapping, item):
         rev = unwrapinteger(context, mapping, item)