##// END OF EJS Templates
hgweb: split graphdata() into jsdata() and nodes()...
av6 -
r35409:a48af499 default
parent child Browse files
Show More
@@ -1231,33 +1231,29 b' def graph(web, req, tmpl):'
1231 tree = list(item for item in graphmod.colored(dag, web.repo)
1231 tree = list(item for item in graphmod.colored(dag, web.repo)
1232 if item[1] == graphmod.CHANGESET)
1232 if item[1] == graphmod.CHANGESET)
1233
1233
1234 def graphdata(usetuples):
1234 def jsdata():
1235 data = []
1235 return [{'node': pycompat.bytestr(ctx),
1236 'vertex': vtx,
1237 'edges': edges}
1238 for (id, type, ctx, vtx, edges) in tree]
1236
1239
1237 row = 0
1240 def nodes():
1238 for (id, type, ctx, vtx, edges) in tree:
1241 for row, (id, type, ctx, vtx, edges) in enumerate(tree):
1239 if usetuples:
1242 entry = webutil.commonentry(web.repo, ctx)
1240 node = pycompat.bytestr(ctx)
1243 edgedata = [{'col': edge[0],
1241 data.append({'node': node, 'vertex': vtx, 'edges': edges})
1244 'nextcol': edge[1],
1242 else:
1245 'color': (edge[2] - 1) % 6 + 1,
1243 entry = webutil.commonentry(web.repo, ctx)
1246 'width': edge[3],
1244 edgedata = [{'col': edge[0], 'nextcol': edge[1],
1247 'bcolor': edge[4]}
1245 'color': (edge[2] - 1) % 6 + 1,
1248 for edge in edges]
1246 'width': edge[3], 'bcolor': edge[4]}
1247 for edge in edges]
1248
1249
1249 entry.update(
1250 entry.update({'col': vtx[0],
1250 {'col': vtx[0],
1251 'color': (vtx[1] - 1) % 6 + 1,
1251 'color': (vtx[1] - 1) % 6 + 1,
1252 'edges': edgedata,
1252 'edges': edgedata,
1253 'row': row,
1253 'row': row,
1254 'nextrow': row + 1})
1254 'nextrow': row + 1})
1255
1255
1256 data.append(entry)
1256 yield entry
1257
1258 row += 1
1259
1260 return data
1261
1257
1262 rows = len(tree)
1258 rows = len(tree)
1263
1259
@@ -1267,8 +1263,8 b' def graph(web, req, tmpl):'
1267 rows=rows,
1263 rows=rows,
1268 bg_height=bg_height,
1264 bg_height=bg_height,
1269 changesets=count,
1265 changesets=count,
1270 jsdata=lambda **x: graphdata(True),
1266 jsdata=lambda **x: jsdata(),
1271 nodes=lambda **x: graphdata(False),
1267 nodes=lambda **x: nodes(),
1272 node=ctx.hex(), changenav=changenav)
1268 node=ctx.hex(), changenav=changenav)
1273
1269
1274 def _getdoc(e):
1270 def _getdoc(e):
General Comments 0
You need to be logged in to leave comments. Login now