comparison mercurial/hgweb/webcommands.py @ 38210:fb5803f4fb87

hgweb: wrap {nodes} of graph with mappinggenerator It was a generator of mappings, which shouldn't be put in template mappings.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 04 Apr 2018 20:48:00 +0900
parents 215021e506e2
children 86f980a8cacf
comparison
equal deleted inserted replaced
38209:215021e506e2 38210:fb5803f4fb87
1328 yield {'node': pycompat.bytestr(ctx), 1328 yield {'node': pycompat.bytestr(ctx),
1329 'graphnode': webutil.getgraphnode(web.repo, ctx), 1329 'graphnode': webutil.getgraphnode(web.repo, ctx),
1330 'vertex': vtx, 1330 'vertex': vtx,
1331 'edges': edges} 1331 'edges': edges}
1332 1332
1333 def nodes(): 1333 def nodes(context):
1334 parity = paritygen(web.stripecount) 1334 parity = paritygen(web.stripecount)
1335 for row, (id, type, ctx, vtx, edges) in enumerate(tree): 1335 for row, (id, type, ctx, vtx, edges) in enumerate(tree):
1336 entry = webutil.commonentry(web.repo, ctx) 1336 entry = webutil.commonentry(web.repo, ctx)
1337 edgedata = [{'col': edge[0], 1337 edgedata = [{'col': edge[0],
1338 'nextcol': edge[1], 1338 'nextcol': edge[1],
1365 rows=rows, 1365 rows=rows,
1366 bg_height=bg_height, 1366 bg_height=bg_height,
1367 changesets=count, 1367 changesets=count,
1368 nextentry=templateutil.mappinglist(nextentry), 1368 nextentry=templateutil.mappinglist(nextentry),
1369 jsdata=templateutil.mappinggenerator(jsdata), 1369 jsdata=templateutil.mappinggenerator(jsdata),
1370 nodes=lambda **x: nodes(), 1370 nodes=templateutil.mappinggenerator(nodes),
1371 node=ctx.hex(), 1371 node=ctx.hex(),
1372 changenav=changenav) 1372 changenav=changenav)
1373 1373
1374 def _getdoc(e): 1374 def _getdoc(e):
1375 doc = e[0].__doc__ 1375 doc = e[0].__doc__