1 diff -r 55982f62651f mercurial/hgweb/webcommands.py 2 --- a/mercurial/hgweb/webcommands.py Wed Apr 18 01:20:16 2012 +0300 3 +++ b/mercurial/hgweb/webcommands.py Sat Apr 28 00:34:29 2012 +0200 4 @@ -785,7 +785,8 @@ 5 tree = list(graphmod.colored(dag, web.repo)) 6 canvasheight = (len(tree) + 1) * bg_height - 27 7 data = [] 8 - for (id, type, ctx, vtx, edges) in tree: 9 + cols = 0 10 + for row, (id, type, ctx, vtx, edges) in enumerate(tree): 11 if type != graphmod.CHANGESET: 12 continue 13 node = str(ctx) 14 @@ -795,13 +796,37 @@ 15 user = cgi.escape(templatefilters.person(ctx.user())) 16 branch = ctx.branch() 17 branch = branch, web.repo.branchtags().get(branch) == ctx.node() 18 - data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), 19 - ctx.bookmarks())) 20 + 21 + edgedata = [dict(col=edge[0], nextcol=edge[1], 22 + color=(edge[2] - 1) % 6 + 1, 23 + width=edge[3], bcolor=edge[4]) for edge in edges] 24 + 25 + data.append(dict(node=node, 26 + col=vtx[0], 27 + color=(vtx[1] - 1) % 6 + 1, 28 + edges=edgedata, 29 + row=row, 30 + nextrow=row+1, 31 + bg_height=bg_height, 32 + desc=desc, 33 + user=user, 34 + age=age, 35 + branchname=branch[0], 36 + branchtip=branch[1], 37 + bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()), 38 + branches=webutil.nodebranchdict(web.repo, ctx), 39 + inbranch=webutil.nodeinbranch(web.repo, ctx), 40 + tags=webutil.nodetagsdict(web.repo, ctx.node()))) 41 + 42 + cols = max(cols, max([edge[0] for edge in edges] or [0]), 43 + max([edge[1] for edge in edges] or [0])) 44 45 return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, 46 lessvars=lessvars, morevars=morevars, downrev=downrev, 47 canvasheight=canvasheight, jsdata=data, bg_height=bg_height, 48 - node=revnode_hex, changenav=changenav) 49 + node=revnode_hex, changenav=changenav, 50 + rows=row+1, cols=cols, canvaswidth=(cols+1)*bg_height, 51 + truecanvasheight=(row+1)*bg_height) 52 53 def _getdoc(e): 54 doc = e[0].__doc__ 55 diff -r 55982f62651f mercurial/templates/static/mercurial.js 56 --- a/mercurial/templates/static/mercurial.js Wed Apr 18 01:20:16 2012 +0300 57 +++ b/mercurial/templates/static/mercurial.js Sat Apr 28 00:34:29 2012 +0200 58 @@ -108,21 +108,22 @@ 59 this.bg[1] += this.bg_height; 60 61 var cur = data[i]; 62 - var node = cur[1]; 63 - var edges = cur[2]; 64 + var column = cur["col"]; 65 + var color; 66 + var edges = cur["edges"]; 67 var fold = false; 68 69 var prevWidth = this.ctx.lineWidth; 70 for (var j in edges) { 71 72 line = edges[j]; 73 - start = line[0]; 74 - end = line[1]; 75 - color = line[2]; 76 - var width = line[3]; 77 + start = line["col"]; 78 + end = line["nextcol"]; 79 + color = line["color"]; 80 + var width = line["width"]; 81 if(width < 0) 82 width = prevWidth; 83 - var branchcolor = line[4]; 84 + var branchcolor = line["bcolor"]; 85 if(branchcolor) 86 color = branchcolor; 87 88 @@ -146,13 +147,12 @@ 89 90 // Draw the revision node in the right column 91 92 - column = node[0] 93 - color = node[1] 94 + color = cur["color"]; 95 96 radius = this.box_size / 8; 97 x = this.cell[0] + this.box_size * column + this.box_size / 2; 98 y = this.bg[1] - this.bg_height / 2; 99 - var add = this.vertex(x, y, color, parity, cur); 100 + var add = this.vertexForEntry(x, y, color, parity, cur); 101 backgrounds += add[0]; 102 nodedata += add[1]; 103 104 @@ -165,6 +165,21 @@ 105 106 } 107 108 + this.vertexForEntry = function(x, y, color, parity, cur) { 109 + var tags = [], bookmarks = []; 110 + for (var i in cur["tags"]) { 111 + tags.push(cur["tags"][i]["name"]); 112 + } 113 + for (var i in cur["bookmarks"]) { 114 + bookmarks.push(cur["bookmarks"][i]["name"]); 115 + } 116 + return this.vertex(x, y, color, parity, [ 117 + cur["node"], [cur["col"], cur["color"]], 118 + cur["edges"], cur["desc"], cur["user"], cur["age"], 119 + [cur["branchname"], cur["branchtip"]], 120 + tags, bookmarks 121 + ]) 122 + } 123 } 124 125