diff mercurial/templatekw.py @ 26234:e4609ec959f8

templater: switch ctx of list expression to rev of revset() (BC) Because revset() function generates a list of revisions, it seems sensible to switch the ctx as well where a list expression will be evaluated. I think "{revset(...) % "..."}" expression wasn't considered well when it was introduced at cda9d2b6beab.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 12 Sep 2015 00:21:41 +0900
parents c57509e88922
children 0a823de8d7b7
line wrap: on
line diff
--- a/mercurial/templatekw.py	Thu Sep 10 23:32:36 2015 +0900
+++ b/mercurial/templatekw.py	Sat Sep 12 00:21:41 2015 +0900
@@ -409,6 +409,14 @@
     """:rev: Integer. The repository-local changeset revision number."""
     return scmutil.intrev(ctx.rev())
 
+def showrevslist(name, revs, **args):
+    """helper to generate a list of revisions in which a mapped template will
+    be evaluated"""
+    repo = args['ctx'].repo()
+    f = _showlist(name, revs, **args)
+    return _hybrid(f, revs,
+                   lambda x: {name: x, 'ctx': repo[x], 'revcache': {}})
+
 def showsubrepos(**args):
     """:subrepos: List of strings. Updated subrepositories in the changeset."""
     ctx = args['ctx']