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 +
2.1 --- a/patches/patch-hgweb-webcommands-SVG.diff Fri Dec 02 00:26:18 2011 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,52 +0,0 @@
2.4 -# HG changeset patch
2.5 -# User Paul Boddie <paul@boddie.org.uk>
2.6 -# Date 1322607302 -3600
2.7 -# Node ID 160b604c1b8f8066976e86c63ece2062f075d1b6
2.8 -# Parent ad686c818e1c7d5ed0335327321003ba8ea04664
2.9 -hgweb: Provide SVG-related data to the output of the graph command
2.10 -
2.11 -diff -r ad686c818e1c -r 160b604c1b8f mercurial/hgweb/webcommands.py
2.12 ---- a/mercurial/hgweb/webcommands.py Fri Nov 25 02:11:12 2011 +0100
2.13 -+++ b/mercurial/hgweb/webcommands.py Tue Nov 29 23:55:02 2011 +0100
2.14 -@@ -772,6 +772,9 @@
2.15 - tree = list(graphmod.colored(dag))
2.16 - canvasheight = (len(tree) + 1) * bg_height - 27
2.17 - data = []
2.18 -+ svgdata = []
2.19 -+ row = 0
2.20 -+ cols = 0
2.21 - for (id, type, ctx, vtx, edges) in tree:
2.22 - if type != graphmod.CHANGESET:
2.23 - continue
2.24 -@@ -784,11 +787,30 @@
2.25 - branch = branch, web.repo.branchtags().get(branch) == ctx.node()
2.26 - data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
2.27 - ctx.bookmarks()))
2.28 -+ svgdata.append(dict(
2.29 -+ node=node,
2.30 -+ col=vtx[0],
2.31 -+ color=(vtx[1] - 1) % 6 + 1,
2.32 -+ edges=[dict(col=edge[0], nextcol=edge[1], color=(edge[2] - 1) % 6 + 1) for edge in edges],
2.33 -+ row=row,
2.34 -+ nextrow=row+1,
2.35 -+ bg_height=bg_height,
2.36 -+ desc=desc,
2.37 -+ user=user,
2.38 -+ age=age,
2.39 -+ bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
2.40 -+ branches=webutil.nodebranchdict(web.repo, ctx),
2.41 -+ inbranch=webutil.nodeinbranch(web.repo, ctx),
2.42 -+ tags=webutil.nodetagsdict(web.repo, ctx.node())))
2.43 -+ row += 1
2.44 -+ cols = max(cols, max([edge[0] for edge in edges] or [0]), max([edge[1] for edge in edges] or [0]))
2.45 -
2.46 - return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
2.47 - lessvars=lessvars, morevars=morevars, downrev=downrev,
2.48 - canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
2.49 -- node=revnode_hex, changenav=changenav)
2.50 -+ node=revnode_hex, changenav=changenav, svgdata=svgdata,
2.51 -+ rows=row, cols=cols, canvaswidth=(cols+1)*bg_height,
2.52 -+ truecanvasheight=row*bg_height)
2.53 -
2.54 - def _getdoc(e):
2.55 - doc = e[0].__doc__
3.1 --- a/patches/patch-hgweb-webcommands-blockno.diff Fri Dec 02 00:26:18 2011 +0100
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,57 +0,0 @@
3.4 -# HG changeset patch
3.5 -# User Paul Boddie <paul@boddie.org.uk>
3.6 -# Date 1322607647 -3600
3.7 -# Node ID 387585e3105efc9df33e947527950ced65320201
3.8 -# Parent ad686c818e1c7d5ed0335327321003ba8ea04664
3.9 -hgweb: Introduce a blockno variable in the changeset's files list and in the diffs webcommand
3.10 -
3.11 -diff -r ad686c818e1c -r 387585e3105e mercurial/hgweb/webcommands.py
3.12 ---- a/mercurial/hgweb/webcommands.py Fri Nov 25 02:11:12 2011 +0100
3.13 -+++ b/mercurial/hgweb/webcommands.py Wed Nov 30 00:00:47 2011 +0100
3.14 -@@ -261,10 +261,10 @@
3.15 -
3.16 - files = []
3.17 - parity = paritygen(web.stripecount)
3.18 -- for f in ctx.files():
3.19 -+ for blockno, f in enumerate(ctx.files()):
3.20 - template = f in ctx and 'filenodelink' or 'filenolink'
3.21 - files.append(tmpl(template,
3.22 -- node=ctx.hex(), file=f,
3.23 -+ node=ctx.hex(), file=f, blockno=blockno+1,
3.24 - parity=parity.next()))
3.25 -
3.26 - style = web.config('web', 'style', 'paper')
3.27 -diff -r ad686c818e1c -r 387585e3105e mercurial/hgweb/webutil.py
3.28 ---- a/mercurial/hgweb/webutil.py Fri Nov 25 02:11:12 2011 +0100
3.29 -+++ b/mercurial/hgweb/webutil.py Wed Nov 30 00:00:47 2011 +0100
3.30 -@@ -173,8 +173,7 @@
3.31 - start += 1
3.32 -
3.33 - blockcount = countgen()
3.34 -- def prettyprintlines(diff):
3.35 -- blockno = blockcount.next()
3.36 -+ def prettyprintlines(diff, blockno):
3.37 - for lineno, l in enumerate(diff.splitlines(True)):
3.38 - lineno = "%d.%d" % (blockno, lineno + 1)
3.39 - if l.startswith('+'):
3.40 -@@ -203,14 +202,16 @@
3.41 - block = []
3.42 - for chunk in patch.diff(repo, node1, node2, m, opts=diffopts):
3.43 - if chunk.startswith('diff') and block:
3.44 -- yield tmpl('diffblock', parity=parity.next(),
3.45 -- lines=prettyprintlines(''.join(block)))
3.46 -+ blockno = blockcount.next()
3.47 -+ yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
3.48 -+ lines=prettyprintlines(''.join(block), blockno))
3.49 - block = []
3.50 - if chunk.startswith('diff') and style != 'raw':
3.51 - chunk = ''.join(chunk.splitlines(True)[1:])
3.52 - block.append(chunk)
3.53 -- yield tmpl('diffblock', parity=parity.next(),
3.54 -- lines=prettyprintlines(''.join(block)))
3.55 -+ blockno = blockcount.next()
3.56 -+ yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
3.57 -+ lines=prettyprintlines(''.join(block), blockno))
3.58 -
3.59 - def diffstatgen(ctx):
3.60 - '''Generator function that provides the diffstat data.'''
4.1 --- a/themes/mercurialweb/graph.tmpl Fri Dec 02 00:26:18 2011 +0100
4.2 +++ b/themes/mercurialweb/graph.tmpl Sat Apr 28 00:35:28 2012 +0200
4.3 @@ -36,13 +36,13 @@
4.4 <div class="graph" style="padding-left:{canvaswidth}px;">
4.5 <table class="graph" style="height:{truecanvasheight}px;">
4.6 <tbody>
4.7 -{svgdata%graphlabel}
4.8 +{jsdata%graphlabel}
4.9 </tbody>
4.10 </table>
4.11 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
4.12 style="width:{canvaswidth}px; height:{truecanvasheight}px; position:absolute; top:0; left:0; z-index:-1;">
4.13 <g transform="scale({bg_height}) translate(0.5 0.5)">
4.14 -{svgdata%graphnode}
4.15 +{jsdata%graphnode}
4.16 </g>
4.17 </svg>
4.18 </div>