Patchwork [8,of,8] hgweb: wrap {archives} with mappinglist

login
register
mail settings
Submitter Yuya Nishihara
Date April 10, 2018, 3:41 p.m.
Message ID <a4d06c685ee182279e91.1523374901@mimosa>
Download mbox | patch
Permalink /patch/30639/
State Accepted
Headers show

Comments

Yuya Nishihara - April 10, 2018, 3:41 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522590109 -32400
#      Sun Apr 01 22:41:49 2018 +0900
# Node ID a4d06c685ee182279e91c2856d8a69e809c6e317
# Parent  d9f6292315ef2e0000e355cccc3a6dc10c20eefd
hgweb: wrap {archives} with mappinglist

No bare list of mappings should be put in a template mapping.
Anton Shestakov - April 11, 2018, 7:10 a.m.
On Wed, 11 Apr 2018 00:41:41 +0900
Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1522590109 -32400
> #      Sun Apr 01 22:41:49 2018 +0900
> # Node ID a4d06c685ee182279e91c2856d8a69e809c6e317
> # Parent  d9f6292315ef2e0000e355cccc3a6dc10c20eefd
> hgweb: wrap {archives} with mappinglist

Queued, thanks!

Patch

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -172,7 +172,7 @@  def rawindexentries(ui, repos, req, subd
                    'description_sort': "",
                    'lastchange': d,
                    'lastchange_sort': d[1] - d[0],
-                   'archives': [],
+                   'archives': templateutil.mappinglist([]),
                    'isdirectory': True,
                    'labels': templateutil.hybridlist([], name='label'),
                    }
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -35,6 +35,7 @@  from .. import (
     scmutil,
     templatefilters,
     templatekw,
+    templateutil,
     ui as uimod,
     util,
 )
@@ -63,7 +64,7 @@  def archivelist(ui, nodeid, url=None):
                 'url': url,
             })
 
-    return archives
+    return templateutil.mappinglist(archives)
 
 def up(p):
     if p[0:1] != "/":