Patchwork [1,of,6] hgweb: wrap {rename} with mappinglist

login
register
mail settings
Submitter Yuya Nishihara
Date May 8, 2018, 1:45 p.m.
Message ID <5eacc9485b57f6bc1a22.1525787128@mimosa>
Download mbox | patch
Permalink /patch/31375/
State Accepted
Headers show

Comments

Yuya Nishihara - May 8, 2018, 1:45 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522594829 -32400
#      Mon Apr 02 00:00:29 2018 +0900
# Node ID 5eacc9485b57f6bc1a22d8309289c3baaa55084e
# Parent  a61583cba509ee388e85221eb69439034868980c
hgweb: wrap {rename} with mappinglist

No bare list of mappings should be put in a template mapping.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -819,7 +819,7 @@  def filediff(web):
         rename = webutil.renamelink(fctx)
         ctx = fctx
     else:
-        rename = []
+        rename = templateutil.mappinglist([])
         ctx = ctx
 
     return web.sendtemplate(
@@ -892,7 +892,7 @@  def comparison(web):
         rename = webutil.renamelink(fctx)
         ctx = fctx
     else:
-        rename = []
+        rename = templateutil.mappinglist([])
         ctx = ctx
 
     return web.sendtemplate(
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -234,8 +234,8 @@  def children(ctx, hide=None):
 def renamelink(fctx):
     r = fctx.renamed()
     if r:
-        return [{'file': r[0], 'node': hex(r[1])}]
-    return []
+        return templateutil.mappinglist([{'file': r[0], 'node': hex(r[1])}])
+    return templateutil.mappinglist([])
 
 def nodetagsdict(repo, node):
     return [{"name": i} for i in repo.nodetags(node)]