MercurialWebTheme

Changeset

53:d50e96b62aa4
2012-04-28 Paul Boddie raw files shortlog changelog graph Fixed the patch for empty repository graphs.
patches/patch-hgweb-graph-data.diff (file)
     1.1 --- a/patches/patch-hgweb-graph-data.diff	Sat Apr 28 00:35:28 2012 +0200
     1.2 +++ b/patches/patch-hgweb-graph-data.diff	Sat Apr 28 01:20:56 2012 +0200
     1.3 @@ -1,17 +1,16 @@
     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 ++++ b/mercurial/hgweb/webcommands.py	Sat Apr 28 01:19:59 2012 +0200
     1.9 +@@ -785,6 +785,8 @@
    1.10       tree = list(graphmod.colored(dag, web.repo))
    1.11       canvasheight = (len(tree) + 1) * bg_height - 27
    1.12       data = []
    1.13 --    for (id, type, ctx, vtx, edges) in tree:
    1.14  +    cols = 0
    1.15 -+    for row, (id, type, ctx, vtx, edges) in enumerate(tree):
    1.16 ++    row = 0
    1.17 +     for (id, type, ctx, vtx, edges) in tree:
    1.18           if type != graphmod.CHANGESET:
    1.19               continue
    1.20 -         node = str(ctx)
    1.21 -@@ -795,13 +796,37 @@
    1.22 +@@ -795,13 +797,38 @@
    1.23           user = cgi.escape(templatefilters.person(ctx.user()))
    1.24           branch = ctx.branch()
    1.25           branch = branch, web.repo.branchtags().get(branch) == ctx.node()
    1.26 @@ -41,20 +40,21 @@
    1.27  +
    1.28  +        cols = max(cols, max([edge[0] for edge in edges] or [0]),
    1.29  +                         max([edge[1] for edge in edges] or [0]))
    1.30 ++        row += 1
    1.31   
    1.32       return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
    1.33                   lessvars=lessvars, morevars=morevars, downrev=downrev,
    1.34                   canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
    1.35  -                node=revnode_hex, changenav=changenav)
    1.36  +                node=revnode_hex, changenav=changenav,
    1.37 -+                rows=row+1, cols=cols, canvaswidth=(cols+1)*bg_height,
    1.38 -+                truecanvasheight=(row+1)*bg_height)
    1.39 ++                rows=row, cols=cols, canvaswidth=(cols+1)*bg_height,
    1.40 ++                truecanvasheight=row*bg_height)
    1.41   
    1.42   def _getdoc(e):
    1.43       doc = e[0].__doc__
    1.44  diff -r 55982f62651f mercurial/templates/static/mercurial.js
    1.45  --- a/mercurial/templates/static/mercurial.js	Wed Apr 18 01:20:16 2012 +0300
    1.46 -+++ b/mercurial/templates/static/mercurial.js	Sat Apr 28 00:34:29 2012 +0200
    1.47 ++++ b/mercurial/templates/static/mercurial.js	Sat Apr 28 01:19:59 2012 +0200
    1.48  @@ -108,21 +108,22 @@
    1.49   			this.bg[1] += this.bg_height;
    1.50