MercurialWebTheme

Changeset

55:a6e6bafe0e00
2012-04-29 Paul Boddie raw files shortlog changelog graph Updated the patch to support and test graph output using the raw style.
patches/patch-hgweb-graph-data.diff (file)
     1.1 --- a/patches/patch-hgweb-graph-data.diff	Sat Apr 28 01:35:38 2012 +0200
     1.2 +++ b/patches/patch-hgweb-graph-data.diff	Sun Apr 29 20:57:36 2012 +0200
     1.3 @@ -1,6 +1,6 @@
     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 01:32:46 2012 +0200
     1.7 ++++ b/mercurial/hgweb/webcommands.py	Sun Apr 29 20:56:26 2012 +0200
     1.8  @@ -785,6 +785,8 @@
     1.9       tree = list(graphmod.colored(dag, web.repo))
    1.10       canvasheight = (len(tree) + 1) * bg_height - 27
    1.11 @@ -10,7 +10,7 @@
    1.12       for (id, type, ctx, vtx, edges) in tree:
    1.13           if type != graphmod.CHANGESET:
    1.14               continue
    1.15 -@@ -795,13 +797,37 @@
    1.16 +@@ -795,13 +797,38 @@
    1.17           user = cgi.escape(templatefilters.person(ctx.user()))
    1.18           branch = ctx.branch()
    1.19           branch = branch, web.repo.branchtags().get(branch) == ctx.node()
    1.20 @@ -30,12 +30,13 @@
    1.21  +                         desc=desc,
    1.22  +                         user=user,
    1.23  +                         age=age,
    1.24 -+                         branchname=branch[0],
    1.25 -+                         branchtip=branch[1],
    1.26  +                         bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
    1.27  +                         branches=webutil.nodebranchdict(web.repo, ctx),
    1.28  +                         inbranch=webutil.nodeinbranch(web.repo, ctx),
    1.29 -+                         tags=webutil.nodetagsdict(web.repo, ctx.node())))
    1.30 ++                         tags=webutil.nodetagsdict(web.repo, ctx.node()),
    1.31 ++                         # convenience values for the canvas graph
    1.32 ++                         branchname=branch[0],
    1.33 ++                         branchtip=branch[1]))
    1.34  +
    1.35  +        cols = max(cols, max([edge[0] for edge in edges] or [0]),
    1.36  +                         max([edge[1] for edge in edges] or [0]))
    1.37 @@ -51,9 +52,48 @@
    1.38   
    1.39   def _getdoc(e):
    1.40       doc = e[0].__doc__
    1.41 +diff -r 55982f62651f mercurial/templates/raw/graph.tmpl
    1.42 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    1.43 ++++ b/mercurial/templates/raw/graph.tmpl	Sun Apr 29 20:56:26 2012 +0200
    1.44 +@@ -0,0 +1,6 @@
    1.45 ++{header}
    1.46 ++# HG graph
    1.47 ++# Node ID {node}
    1.48 ++# Rows shown {rows}
    1.49 ++
    1.50 ++{jsdata%graphnode}
    1.51 +diff -r 55982f62651f mercurial/templates/raw/graphedge.tmpl
    1.52 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    1.53 ++++ b/mercurial/templates/raw/graphedge.tmpl	Sun Apr 29 20:56:26 2012 +0200
    1.54 +@@ -0,0 +1,1 @@
    1.55 ++edge:        ({col}, {row}) -> ({nextcol}, {nextrow}) (color {color})
    1.56 +diff -r 55982f62651f mercurial/templates/raw/graphnode.tmpl
    1.57 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    1.58 ++++ b/mercurial/templates/raw/graphnode.tmpl	Sun Apr 29 20:56:26 2012 +0200
    1.59 +@@ -0,0 +1,7 @@
    1.60 ++changeset:   {node}
    1.61 ++user:        {user}
    1.62 ++date:        {age}
    1.63 ++summary:     {desc}
    1.64 ++{branches%branchname}{tags%tagname}{bookmarks%bookmarkname}
    1.65 ++node:        ({col}, {row}) (color {color})
    1.66 ++{edges%graphedge}
    1.67 +diff -r 55982f62651f mercurial/templates/raw/map
    1.68 +--- a/mercurial/templates/raw/map	Wed Apr 18 01:20:16 2012 +0300
    1.69 ++++ b/mercurial/templates/raw/map	Sun Apr 29 20:56:26 2012 +0200
    1.70 +@@ -28,3 +28,9 @@
    1.71 + bookmarkentry = '{bookmark}	{node}\n'
    1.72 + branches = '{entries%branchentry}'
    1.73 + branchentry = '{branch}	{node}	{status}\n'
    1.74 ++graph = graph.tmpl
    1.75 ++graphnode = graphnode.tmpl
    1.76 ++graphedge = graphedge.tmpl
    1.77 ++bookmarkname = 'bookmark:    {name}\n'
    1.78 ++branchname = 'branch:      {name}\n'
    1.79 ++tagname = 'tag:         {name}\n'
    1.80  diff -r 55982f62651f mercurial/templates/static/mercurial.js
    1.81  --- a/mercurial/templates/static/mercurial.js	Wed Apr 18 01:20:16 2012 +0300
    1.82 -+++ b/mercurial/templates/static/mercurial.js	Sat Apr 28 01:32:46 2012 +0200
    1.83 ++++ b/mercurial/templates/static/mercurial.js	Sun Apr 29 20:56:26 2012 +0200
    1.84  @@ -108,21 +108,22 @@
    1.85   			this.bg[1] += this.bg_height;
    1.86   			
    1.87 @@ -124,7 +164,7 @@
    1.88   
    1.89  diff -r 55982f62651f tests/test-hgweb-commands.t
    1.90  --- a/tests/test-hgweb-commands.t	Wed Apr 18 01:20:16 2012 +0300
    1.91 -+++ b/tests/test-hgweb-commands.t	Sat Apr 28 01:32:46 2012 +0200
    1.92 ++++ b/tests/test-hgweb-commands.t	Sun Apr 29 20:56:26 2012 +0200
    1.93  @@ -957,7 +957,7 @@
    1.94     <script>
    1.95     <!-- hide script content
    1.96 @@ -134,7 +174,64 @@
    1.97     var graph = new Graph();
    1.98     graph.scale(39);
    1.99     
   1.100 -@@ -1214,7 +1214,7 @@
   1.101 +@@ -1037,6 +1037,56 @@
   1.102 +   </div>
   1.103 +   </body>
   1.104 +   </html>
   1.105 ++  
   1.106 ++
   1.107 ++raw graph
   1.108 ++
   1.109 ++  $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/?style=raw'
   1.110 ++  200 Script output follows
   1.111 ++  
   1.112 ++  
   1.113 ++  # HG graph
   1.114 ++  # Node ID ba87b23d29ca67a305625d81a20ac279c1e3f444
   1.115 ++  # Rows shown 4
   1.116 ++  
   1.117 ++  changeset:   ba87b23d29ca
   1.118 ++  user:        test
   1.119 ++  date:        1970-01-01
   1.120 ++  summary:     branch
   1.121 ++  branch:      unstable
   1.122 ++  tag:         tip
   1.123 ++  bookmark:    something
   1.124 ++  
   1.125 ++  node:        (0, 0) (color 1)
   1.126 ++  edge:        (0, 0) -> (0, 1) (color 1)
   1.127 ++  
   1.128 ++  changeset:   1d22e65f027e
   1.129 ++  user:        test
   1.130 ++  date:        1970-01-01
   1.131 ++  summary:     branch
   1.132 ++  branch:      stable
   1.133 ++  
   1.134 ++  node:        (0, 1) (color 1)
   1.135 ++  edge:        (0, 1) -> (0, 2) (color 1)
   1.136 ++  
   1.137 ++  changeset:   a4f92ed23982
   1.138 ++  user:        test
   1.139 ++  date:        1970-01-01
   1.140 ++  summary:     Added tag 1.0 for changeset 2ef0ac749a14
   1.141 ++  branch:      default
   1.142 ++  
   1.143 ++  node:        (0, 2) (color 1)
   1.144 ++  edge:        (0, 2) -> (0, 3) (color 1)
   1.145 ++  
   1.146 ++  changeset:   2ef0ac749a14
   1.147 ++  user:        test
   1.148 ++  date:        1970-01-01
   1.149 ++  summary:     base
   1.150 ++  tag:         1.0
   1.151 ++  bookmark:    anotherthing
   1.152 ++  
   1.153 ++  node:        (0, 3) (color 1)
   1.154 ++  
   1.155 +   
   1.156 + 
   1.157 + capabilities
   1.158 +@@ -1214,7 +1264,7 @@
   1.159   
   1.160     $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/' \
   1.161     >     | grep '^var data ='