hgweb: make revnav.gen() simply build a list of mappings by one pass
There was actually no lazy stuff.
--- 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):