Patchwork [2,of,8] templater: do not destructure operands in buildmap()

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 24, 2017, 12:21 p.m.
Message ID <596b89fea274b424ff0d.1506255711@mimosa>
Download mbox | patch
Permalink /patch/24128/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 24, 2017, 12:21 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504361374 -32400
#      Sat Sep 02 23:09:34 2017 +0900
# Node ID 596b89fea274b424ff0da758817632e95bc0b64c
# Parent  3ffcbeb430fd598e253c8ee8b70cfc23978f7c09
templater: do not destructure operands in buildmap()

This makes the next patch slightly simpler.

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -410,12 +410,12 @@  def runfilter(context, mapping, data):
         raise error.Abort(msg)
 
 def buildmap(exp, context):
-    func, data = compileexp(exp[1], context, methods)
-    tfunc, tdata = gettemplate(exp[2], context)
-    return (runmap, (func, data, tfunc, tdata))
+    darg = compileexp(exp[1], context, methods)
+    targ = gettemplate(exp[2], context)
+    return (runmap, (darg, targ))
 
 def runmap(context, mapping, data):
-    func, data, tfunc, tdata = data
+    (func, data), (tfunc, tdata) = data
     d = func(context, mapping, data)
     if util.safehasattr(d, 'itermaps'):
         diter = d.itermaps()