hgweb: wrap {changenav} and {nav} with mappinglist
authorYuya Nishihara <yuya@tcha.org>
Sun, 01 Apr 2018 23:40:08 +0900
changeset 37698 7738ae638b62
parent 37697 6fb50e912aa8
child 37699 0e02eb838b96
hgweb: wrap {changenav} and {nav} with mappinglist
mercurial/hgweb/webcommands.py
mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webcommands.py	Sun Apr 01 23:34:29 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Apr 01 23:40:08 2018 +0900
@@ -1084,7 +1084,7 @@
         linerange = webutil.formatlinerange(*lrange)
         # deactivate numeric nav links when linerange is specified as this
         # would required a dedicated "revnav" class
-        nav = []
+        nav = templateutil.mappinglist([])
         if descend:
             it = dagop.blockdescendants(fctx, *lrange)
         else:
--- a/mercurial/hgweb/webutil.py	Sun Apr 01 23:34:29 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Sun Apr 01 23:40:08 2018 +0900
@@ -125,13 +125,16 @@
         :limit: how far shall we link
 
         The return is:
-            - a single element tuple
+            - a single element mappinglist
             - containing a dictionary with a `before` and `after` key
             - values are dictionaries with `label` and `node` keys
         """
         if not self:
             # empty repo
-            return ({'before': (), 'after': ()},)
+            return templateutil.mappinglist([
+                {'before': templateutil.mappinglist([]),
+                 'after': templateutil.mappinglist([])},
+            ])
 
         targets = []
         for f in _navseq(1, pagelen):
@@ -156,7 +159,11 @@
 
         navafter.append({'label': 'tip', 'node': 'tip'})
 
-        return ({'before': navbefore, 'after': navafter},)
+        # TODO: maybe this can be a scalar object supporting tomap()
+        return templateutil.mappinglist([
+            {'before': templateutil.mappinglist(navbefore),
+             'after': templateutil.mappinglist(navafter)},
+        ])
 
 class filerevnav(revnav):