[PATCH 2 of 7] hgweb: adapt {jsdata} of graph to mappinggenerator
Yuya Nishihara
yuya at tcha.org
Fri May 25 09:54:12 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1522842372 -32400
# Wed Apr 04 20:46:12 2018 +0900
# Node ID 7758a9a1f49b02dea023ab970e65af1874e6d636
# Parent a2ff4a325229bd72a5447abe1efa3a2659fcc50b
hgweb: adapt {jsdata} of graph to mappinggenerator
The laziness is handled by the mappinggenerator class.
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1323,12 +1323,12 @@ def graph(web):
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 @@ def graph(web):
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)
More information about the Mercurial-devel
mailing list