# HG changeset patch # User Paul Boddie # Date 1335568856 -7200 # Node ID d50e96b62aa416c156ddc569a18ac3b64455bf6c # Parent 84c2b3fdf0b92228810457528bc8400caf5bde5d Fixed the patch for empty repository graphs. diff -r 84c2b3fdf0b9 -r d50e96b62aa4 patches/patch-hgweb-graph-data.diff --- a/patches/patch-hgweb-graph-data.diff Sat Apr 28 00:35:28 2012 +0200 +++ b/patches/patch-hgweb-graph-data.diff Sat Apr 28 01:20:56 2012 +0200 @@ -1,17 +1,16 @@ diff -r 55982f62651f mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Wed Apr 18 01:20:16 2012 +0300 -+++ b/mercurial/hgweb/webcommands.py Sat Apr 28 00:34:29 2012 +0200 -@@ -785,7 +785,8 @@ ++++ b/mercurial/hgweb/webcommands.py Sat Apr 28 01:19:59 2012 +0200 +@@ -785,6 +785,8 @@ tree = list(graphmod.colored(dag, web.repo)) canvasheight = (len(tree) + 1) * bg_height - 27 data = [] -- for (id, type, ctx, vtx, edges) in tree: + cols = 0 -+ for row, (id, type, ctx, vtx, edges) in enumerate(tree): ++ row = 0 + for (id, type, ctx, vtx, edges) in tree: if type != graphmod.CHANGESET: continue - node = str(ctx) -@@ -795,13 +796,37 @@ +@@ -795,13 +797,38 @@ user = cgi.escape(templatefilters.person(ctx.user())) branch = ctx.branch() branch = branch, web.repo.branchtags().get(branch) == ctx.node() @@ -41,20 +40,21 @@ + + cols = max(cols, max([edge[0] for edge in edges] or [0]), + max([edge[1] for edge in edges] or [0])) ++ row += 1 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, -+ rows=row+1, cols=cols, canvaswidth=(cols+1)*bg_height, -+ truecanvasheight=(row+1)*bg_height) ++ rows=row, cols=cols, canvaswidth=(cols+1)*bg_height, ++ truecanvasheight=row*bg_height) def _getdoc(e): doc = e[0].__doc__ diff -r 55982f62651f mercurial/templates/static/mercurial.js --- a/mercurial/templates/static/mercurial.js Wed Apr 18 01:20:16 2012 +0300 -+++ b/mercurial/templates/static/mercurial.js Sat Apr 28 00:34:29 2012 +0200 ++++ b/mercurial/templates/static/mercurial.js Sat Apr 28 01:19:59 2012 +0200 @@ -108,21 +108,22 @@ this.bg[1] += this.bg_height;