# HG changeset patch # User Paul Boddie # Date 1317566750 -7200 # Node ID 476d910a2c6a464f2755ce83c150267b3aca459e # Parent 9237523a30e0cdfe5092b08f7b6547850a14ae10 Added some patches for hgweb that are required by this theme. diff -r 9237523a30e0 -r 476d910a2c6a patches/patch-hgweb-webcommands-SVG.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/patch-hgweb-webcommands-SVG.diff Sun Oct 02 16:45:50 2011 +0200 @@ -0,0 +1,44 @@ +diff -r b2d4400398f3 mercurial/hgweb/webcommands.py +--- a/mercurial/hgweb/webcommands.py Tue Sep 27 18:51:10 2011 +0200 ++++ b/mercurial/hgweb/webcommands.py Sun Oct 02 16:41:16 2011 +0200 +@@ -770,6 +770,9 @@ + tree = list(graphmod.colored(dag)) + canvasheight = (len(tree) + 1) * bg_height - 27 + data = [] ++ svgdata = [] ++ row = 0 ++ cols = 0 + for (id, type, ctx, vtx, edges) in tree: + if type != graphmod.CHANGESET: + continue +@@ -782,11 +785,29 @@ + branch = branch, web.repo.branchtags().get(branch) == ctx.node() + data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), + ctx.bookmarks())) ++ svgdata.append(dict( ++ node=node, ++ col=vtx[0], ++ color=(vtx[1] - 1) % 6 + 1, ++ edges=[dict(col=edge[0], nextcol=edge[1], color=(edge[2] - 1) % 6 + 1) for edge in edges], ++ row=row, ++ nextrow=row+1, ++ bg_height=bg_height, ++ desc=desc, ++ user=user, ++ age=age, ++ branches=webutil.nodebranchdict(web.repo, ctx), ++ inbranch=webutil.nodeinbranch(web.repo, ctx), ++ tags=webutil.nodetagsdict(web.repo, ctx.node()))) ++ row += 1 ++ cols = max(cols, max([edge[0] for edge in edges] or [0]), max([edge[1] for edge in edges] or [0])) + + return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, + lessvars=lessvars, morevars=morevars, downrev=downrev, + canvasheight=canvasheight, jsdata=data, bg_height=bg_height, +- node=revnode_hex, changenav=changenav) ++ node=revnode_hex, changenav=changenav, svgdata=svgdata, ++ rows=row, cols=cols, canvaswidth=(cols+1)*bg_height, ++ truecanvasheight=row*bg_height) + + def _getdoc(e): + doc = e[0].__doc__ diff -r 9237523a30e0 -r 476d910a2c6a patches/patch-hgweb-webcommands-blockno.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/patch-hgweb-webcommands-blockno.diff Sun Oct 02 16:45:50 2011 +0200 @@ -0,0 +1,50 @@ +diff -r 8a4044aacc27 mercurial/hgweb/webcommands.py +--- a/mercurial/hgweb/webcommands.py Sun Oct 02 16:41:33 2011 +0200 ++++ b/mercurial/hgweb/webcommands.py Sun Oct 02 16:42:11 2011 +0200 +@@ -261,10 +261,10 @@ + + files = [] + parity = paritygen(web.stripecount) +- for f in ctx.files(): ++ for blockno, f in enumerate(ctx.files()): + template = f in ctx and 'filenodelink' or 'filenolink' + files.append(tmpl(template, +- node=ctx.hex(), file=f, ++ node=ctx.hex(), file=f, blockno=blockno+1, + parity=parity.next())) + + style = web.config('web', 'style', 'paper') +diff -r 8a4044aacc27 mercurial/hgweb/webutil.py +--- a/mercurial/hgweb/webutil.py Sun Oct 02 16:41:33 2011 +0200 ++++ b/mercurial/hgweb/webutil.py Sun Oct 02 16:42:11 2011 +0200 +@@ -173,8 +173,7 @@ + start += 1 + + blockcount = countgen() +- def prettyprintlines(diff): +- blockno = blockcount.next() ++ def prettyprintlines(diff, blockno): + for lineno, l in enumerate(diff.splitlines(True)): + lineno = "%d.%d" % (blockno, lineno + 1) + if l.startswith('+'): +@@ -203,14 +202,16 @@ + block = [] + for chunk in patch.diff(repo, node1, node2, m, opts=diffopts): + if chunk.startswith('diff') and block: +- yield tmpl('diffblock', parity=parity.next(), +- lines=prettyprintlines(''.join(block))) ++ blockno = blockcount.next() ++ yield tmpl('diffblock', parity=parity.next(), blockno=blockno, ++ lines=prettyprintlines(''.join(block), blockno)) + block = [] + if chunk.startswith('diff') and style != 'raw': + chunk = ''.join(chunk.splitlines(True)[1:]) + block.append(chunk) +- yield tmpl('diffblock', parity=parity.next(), +- lines=prettyprintlines(''.join(block))) ++ blockno = blockcount.next() ++ yield tmpl('diffblock', parity=parity.next(), blockno=blockno, ++ lines=prettyprintlines(''.join(block), blockno)) + + def diffstatgen(ctx): + '''Generator function that provides the diffstat data.'''