Patchwork [8,of,8] templater: deduplicate iterator of overlay mappings

login
register
mail settings
Submitter Yuya Nishihara
Date April 5, 2018, 2:37 p.m.
Message ID <0e92d8efaea91db21670.1522939046@mimosa>
Download mbox | patch
Permalink /patch/30383/
State Accepted
Headers show

Comments

Yuya Nishihara - April 5, 2018, 2:37 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522673652 -32400
#      Mon Apr 02 21:54:12 2018 +0900
# Node ID 0e92d8efaea91db21670c7158b1128f924b30cf4
# Parent  00c9dda81b49f4242f174fd218c68b5c8bbc5fea
templater: deduplicate iterator of overlay mappings
Augie Fackler - April 6, 2018, 7:35 p.m.
On Thu, Apr 05, 2018 at 11:37:26PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1522673652 -32400
> #      Mon Apr 02 21:54:12 2018 +0900
> # Node ID 0e92d8efaea91db21670c7158b1128f924b30cf4
> # Parent  00c9dda81b49f4242f174fd218c68b5c8bbc5fea
> templater: deduplicate iterator of overlay mappings

queued, thanks

Patch

diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -599,9 +599,7 @@  def runmap(context, mapping, data):
         diter = d.itermaps(context)
     else:
         diter = _checkeditermaps(darg, d)
-    for i, v in enumerate(diter):
-        lm = context.overlaymap(mapping, v)
-        lm['index'] = i
+    for lm in _iteroverlaymaps(context, mapping, diter):
         yield evalrawexp(context, lm, targ)
 
 def runmember(context, mapping, data):