changeset 38209:215021e506e2

hgweb: adapt {jsdata} of graph to mappinggenerator The laziness is handled by the mappinggenerator class.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 04 Apr 2018 20:46:12 +0900
parents b10a9ace2738
children fb5803f4fb87
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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)