1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/patch-hgweb-graph-data.diff Sat Apr 28 00:35:28 2012 +0200
1.3 @@ -0,0 +1,125 @@
1.4 +diff -r 55982f62651f mercurial/hgweb/webcommands.py
1.5 +--- a/mercurial/hgweb/webcommands.py Wed Apr 18 01:20:16 2012 +0300
1.6 ++++ b/mercurial/hgweb/webcommands.py Sat Apr 28 00:34:29 2012 +0200
1.7 +@@ -785,7 +785,8 @@
1.8 + tree = list(graphmod.colored(dag, web.repo))
1.9 + canvasheight = (len(tree) + 1) * bg_height - 27
1.10 + data = []
1.11 +- for (id, type, ctx, vtx, edges) in tree:
1.12 ++ cols = 0
1.13 ++ for row, (id, type, ctx, vtx, edges) in enumerate(tree):
1.14 + if type != graphmod.CHANGESET:
1.15 + continue
1.16 + node = str(ctx)
1.17 +@@ -795,13 +796,37 @@
1.18 + user = cgi.escape(templatefilters.person(ctx.user()))
1.19 + branch = ctx.branch()
1.20 + branch = branch, web.repo.branchtags().get(branch) == ctx.node()
1.21 +- data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
1.22 +- ctx.bookmarks()))
1.23 ++
1.24 ++ edgedata = [dict(col=edge[0], nextcol=edge[1],
1.25 ++ color=(edge[2] - 1) % 6 + 1,
1.26 ++ width=edge[3], bcolor=edge[4]) for edge in edges]
1.27 ++
1.28 ++ data.append(dict(node=node,
1.29 ++ col=vtx[0],
1.30 ++ color=(vtx[1] - 1) % 6 + 1,
1.31 ++ edges=edgedata,
1.32 ++ row=row,
1.33 ++ nextrow=row+1,
1.34 ++ bg_height=bg_height,
1.35 ++ desc=desc,
1.36 ++ user=user,
1.37 ++ age=age,
1.38 ++ branchname=branch[0],
1.39 ++ branchtip=branch[1],
1.40 ++ bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
1.41 ++ branches=webutil.nodebranchdict(web.repo, ctx),
1.42 ++ inbranch=webutil.nodeinbranch(web.repo, ctx),
1.43 ++ tags=webutil.nodetagsdict(web.repo, ctx.node())))
1.44 ++
1.45 ++ cols = max(cols, max([edge[0] for edge in edges] or [0]),
1.46 ++ max([edge[1] for edge in edges] or [0]))
1.47 +
1.48 + return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
1.49 + lessvars=lessvars, morevars=morevars, downrev=downrev,
1.50 + canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
1.51 +- node=revnode_hex, changenav=changenav)
1.52 ++ node=revnode_hex, changenav=changenav,
1.53 ++ rows=row+1, cols=cols, canvaswidth=(cols+1)*bg_height,
1.54 ++ truecanvasheight=(row+1)*bg_height)
1.55 +
1.56 + def _getdoc(e):
1.57 + doc = e[0].__doc__
1.58 +diff -r 55982f62651f mercurial/templates/static/mercurial.js
1.59 +--- a/mercurial/templates/static/mercurial.js Wed Apr 18 01:20:16 2012 +0300
1.60 ++++ b/mercurial/templates/static/mercurial.js Sat Apr 28 00:34:29 2012 +0200
1.61 +@@ -108,21 +108,22 @@
1.62 + this.bg[1] += this.bg_height;
1.63 +
1.64 + var cur = data[i];
1.65 +- var node = cur[1];
1.66 +- var edges = cur[2];
1.67 ++ var column = cur["col"];
1.68 ++ var color;
1.69 ++ var edges = cur["edges"];
1.70 + var fold = false;
1.71 +
1.72 + var prevWidth = this.ctx.lineWidth;
1.73 + for (var j in edges) {
1.74 +
1.75 + line = edges[j];
1.76 +- start = line[0];
1.77 +- end = line[1];
1.78 +- color = line[2];
1.79 +- var width = line[3];
1.80 ++ start = line["col"];
1.81 ++ end = line["nextcol"];
1.82 ++ color = line["color"];
1.83 ++ var width = line["width"];
1.84 + if(width < 0)
1.85 + width = prevWidth;
1.86 +- var branchcolor = line[4];
1.87 ++ var branchcolor = line["bcolor"];
1.88 + if(branchcolor)
1.89 + color = branchcolor;
1.90 +
1.91 +@@ -146,13 +147,12 @@
1.92 +
1.93 + // Draw the revision node in the right column
1.94 +
1.95 +- column = node[0]
1.96 +- color = node[1]
1.97 ++ color = cur["color"];
1.98 +
1.99 + radius = this.box_size / 8;
1.100 + x = this.cell[0] + this.box_size * column + this.box_size / 2;
1.101 + y = this.bg[1] - this.bg_height / 2;
1.102 +- var add = this.vertex(x, y, color, parity, cur);
1.103 ++ var add = this.vertexForEntry(x, y, color, parity, cur);
1.104 + backgrounds += add[0];
1.105 + nodedata += add[1];
1.106 +
1.107 +@@ -165,6 +165,21 @@
1.108 +
1.109 + }
1.110 +
1.111 ++ this.vertexForEntry = function(x, y, color, parity, cur) {
1.112 ++ var tags = [], bookmarks = [];
1.113 ++ for (var i in cur["tags"]) {
1.114 ++ tags.push(cur["tags"][i]["name"]);
1.115 ++ }
1.116 ++ for (var i in cur["bookmarks"]) {
1.117 ++ bookmarks.push(cur["bookmarks"][i]["name"]);
1.118 ++ }
1.119 ++ return this.vertex(x, y, color, parity, [
1.120 ++ cur["node"], [cur["col"], cur["color"]],
1.121 ++ cur["edges"], cur["desc"], cur["user"], cur["age"],
1.122 ++ [cur["branchname"], cur["branchtip"]],
1.123 ++ tags, bookmarks
1.124 ++ ])
1.125 ++ }
1.126 + }
1.127 +
1.128 +