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

Yuya Nishihara yuya at tcha.org
Tue May 8 13:45:28 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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)]


More information about the Mercurial-devel mailing list