@@ -36,9 +36,7 @@ from .. import (
revsetlang,
scmutil,
smartset,
- templatefilters,
templater,
- url,
util,
)
@@ -1242,8 +1240,6 @@ def graph(web, req, tmpl):
return cols
def graphdata(usetuples):
- # {jsdata} will be passed to |json, so it must be in utf-8
- encodestr = encoding.fromlocal
data = []
row = 0
@@ -1253,22 +1249,7 @@ def graph(web, req, tmpl):
if usetuples:
node = pycompat.bytestr(ctx)
- age = encodestr(templatefilters.age(ctx.date()))
- desc = templatefilters.firstline(encodestr(ctx.description()))
- desc = url.escape(templatefilters.nonempty(desc))
- user = templatefilters.person(encodestr(ctx.user()))
- user = url.escape(user)
- branch = url.escape(encodestr(ctx.branch()))
- try:
- branchnode = web.repo.branchtip(ctx.branch())
- except error.RepoLookupError:
- branchnode = None
- branch = branch, branchnode == ctx.node()
-
- data.append((node, vtx, edges, desc, user, age, branch,
- [url.escape(encodestr(x)) for x in ctx.tags()],
- [url.escape(encodestr(x))
- for x in ctx.bookmarks()]))
+ data.append({'node': node, 'vertex': vtx, 'edges': edges})
else:
entry = webutil.commonentry(web.repo, ctx)
edgedata = [{'col': edge[0], 'nextcol': edge[1],
@@ -103,14 +103,12 @@ function Graph() {
this.bg[1] += this.bg_height;
var cur = data[i];
- var node = cur[1];
- var edges = cur[2];
var fold = false;
var prevWidth = this.ctx.lineWidth;
- for (var j = 0; j < edges.length; j++) {
+ for (var j = 0; j < cur.edges.length; j++) {
- line = edges[j];
+ line = cur.edges[j];
start = line[0];
end = line[1];
color = line[2];
@@ -141,8 +139,8 @@ function Graph() {
// Draw the revision node in the right column
- column = node[0];
- color = node[1];
+ column = cur.vertex[0];
+ color = cur.vertex[1];
radius = this.box_size / 8;
x = this.cell[0] + this.box_size * column + this.box_size / 2;
@@ -1788,7 +1788,7 @@ Overviews
<script>
<!-- hide script content
- var data = [["cad8025a2e87", [0, 1], [[0, 0, 1, 3, "FF0000"]], "branch commit with null character: \u0000", "test", "1970-01-01", ["unstable", true], ["tip"], ["something"]], ["1d22e65f027e", [0, 1], [[0, 0, 1, 3, ""]], "branch", "test", "1970-01-01", ["stable", true], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1, 3, ""]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], ["anotherthing"]]];
+ var data = [{"edges": [[0, 0, 1, 3, "FF0000"]], "node": "cad8025a2e87", "vertex": [0, 1]}, {"edges": [[0, 0, 1, 3, ""]], "node": "1d22e65f027e", "vertex": [0, 1]}, {"edges": [[0, 0, 1, 3, ""]], "node": "a4f92ed23982", "vertex": [0, 1]}, {"edges": [], "node": "2ef0ac749a14", "vertex": [0, 1]}];
var graph = new Graph();
graph.scale(39);