hgweb: adapt {jsdata} of graph to mappinggenerator
The laziness is handled by the mappinggenerator class.
--- a/mercurial/hgweb/webcommands.py Wed Apr 04 20:44:18 2018 +0900
+++ b/mercurial/hgweb/webcommands.py Wed Apr 04 20:46:12 2018 +0900
@@ -1323,12 +1323,12 @@
if item[1] == graphmod.CHANGESET)
return tree
- def jsdata():
- return [{'node': pycompat.bytestr(ctx),
- 'graphnode': webutil.getgraphnode(web.repo, ctx),
- 'vertex': vtx,
- 'edges': edges}
- for (id, type, ctx, vtx, edges) in fulltree()]
+ def jsdata(context):
+ for (id, type, ctx, vtx, edges) in fulltree():
+ yield {'node': pycompat.bytestr(ctx),
+ 'graphnode': webutil.getgraphnode(web.repo, ctx),
+ 'vertex': vtx,
+ 'edges': edges}
def nodes():
parity = paritygen(web.stripecount)
@@ -1366,7 +1366,7 @@
bg_height=bg_height,
changesets=count,
nextentry=templateutil.mappinglist(nextentry),
- jsdata=lambda **x: jsdata(),
+ jsdata=templateutil.mappinggenerator(jsdata),
nodes=lambda **x: nodes(),
node=ctx.hex(),
changenav=changenav)