mercurial/templatefuncs.py
changeset 44599 1f81f680912f
parent 44597 fc1fa3a07af6
child 44600 7cd5c0968139
--- a/mercurial/templatefuncs.py	Sun Mar 15 22:01:38 2020 +0900
+++ b/mercurial/templatefuncs.py	Sun Mar 15 16:00:45 2020 +0900
@@ -658,17 +658,19 @@
         return m(repo)
 
     if len(args) > 1:
+        key = None  # dynamically-created revs shouldn't be cached
         formatargs = [evalfuncarg(context, mapping, a) for a in args[1:]]
         revs = query(revsetlang.formatspec(raw, *formatargs))
     else:
         cache = context.resource(mapping, b'cache')
         revsetcache = cache.setdefault(b"revsetcache", {})
-        if raw in revsetcache:
-            revs = revsetcache[raw]
+        key = raw
+        if key in revsetcache:
+            revs = revsetcache[key]
         else:
             revs = query(raw)
-            revsetcache[raw] = revs
-    return templateutil.revslist(repo, revs, name=b'revision')
+            revsetcache[key] = revs
+    return templateutil.revslist(repo, revs, name=b'revision', cachekey=key)
 
 
 @templatefunc(b'rstdoc(text, style)')