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