Mercurial > hg-stable
changeset 37697:6fb50e912aa8
hgweb: make revnav.gen() simply build a list of mappings by one pass
There was actually no lazy stuff.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Apr 2018 23:34:29 +0900 |
parents | 9ac3e97b299b |
children | 7738ae638b62 |
files | mercurial/hgweb/webutil.py |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py Sun Apr 01 23:12:37 2018 +0900 +++ b/mercurial/hgweb/webutil.py Sun Apr 01 23:34:29 2018 +0900 @@ -127,8 +127,7 @@ The return is: - a single element tuple - containing a dictionary with a `before` and `after` key - - values are generator functions taking arbitrary number of kwargs - - yield items are dictionaries with `label` and `node` keys + - values are dictionaries with `label` and `node` keys """ if not self: # empty repo @@ -143,22 +142,21 @@ targets.sort() first = self._first() - navbefore = [("(%i)" % first, self.hex(first))] + navbefore = [{'label': '(%i)' % first, 'node': self.hex(first)}] navafter = [] for rev in targets: if rev not in self._revlog: continue if pos < rev < limit: - navafter.append(("+%d" % abs(rev - pos), self.hex(rev))) + navafter.append({'label': '+%d' % abs(rev - pos), + 'node': self.hex(rev)}) if 0 < rev < pos: - navbefore.append(("-%d" % abs(rev - pos), self.hex(rev))) - + navbefore.append({'label': '-%d' % abs(rev - pos), + 'node': self.hex(rev)}) - navafter.append(("tip", "tip")) + navafter.append({'label': 'tip', 'node': 'tip'}) - data = lambda i: {"label": i[0], "node": i[1]} - return ({'before': lambda **map: (data(i) for i in navbefore), - 'after': lambda **map: (data(i) for i in navafter)},) + return ({'before': navbefore, 'after': navafter},) class filerevnav(revnav):