Mercurial > hg
changeset 37698:7738ae638b62
hgweb: wrap {changenav} and {nav} with mappinglist
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Apr 2018 23:40:08 +0900 |
parents | 6fb50e912aa8 |
children | 0e02eb838b96 |
files | mercurial/hgweb/webcommands.py mercurial/hgweb/webutil.py |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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):