diff mercurial/templater.py @ 34328:dd28b1f55eb8

templatekw: just pass underlying value (or key) to joinfmt() function Before, iter(hybrid) was proxied to hybrid.gen, which generated formatted strings. That's why we had to apply joinfmt() to the dicts generated by hybrid.itermaps(). Since this weird API was fixed at a0f2d83f8083, we can get rid of the makemap() calls from join().
author Yuya Nishihara <yuya@tcha.org>
date Sun, 24 Sep 2017 15:22:46 +0900
parents e60c601953d7
children 6367318327f0
line wrap: on
line diff
--- a/mercurial/templater.py	Sun Sep 24 12:43:57 2017 +0900
+++ b/mercurial/templater.py	Sun Sep 24 15:22:46 2017 +0900
@@ -768,10 +768,7 @@
     # TODO: perhaps this should be evalfuncarg(), but it can't because hgweb
     # abuses generator as a keyword that returns a list of dicts.
     joinset = evalrawexp(context, mapping, args[0])
-    if util.safehasattr(joinset, 'itermaps'):
-        jf = joinset.joinfmt
-        joinset = [jf(x) for x in joinset.itermaps()]
-
+    joinfmt = getattr(joinset, 'joinfmt', pycompat.identity)
     joiner = " "
     if len(args) > 1:
         joiner = evalstring(context, mapping, args[1])
@@ -782,7 +779,7 @@
             first = False
         else:
             yield joiner
-        yield x
+        yield joinfmt(x)
 
 @templatefunc('label(label, expr)')
 def label(context, mapping, args):