# HG changeset patch # User Yuya Nishihara # Date 1522842372 -32400 # Node ID 215021e506e228705c7b2fe7d8392e7981e8abbc # Parent b10a9ace2738e9c1a8f4155c9ec36b3e1ac5626d hgweb: adapt {jsdata} of graph to mappinggenerator The laziness is handled by the mappinggenerator class. diff -r b10a9ace2738 -r 215021e506e2 mercurial/hgweb/webcommands.py --- 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)