templates/paper/graph.tmpl
changeset 9999 f91e5630ce7e
parent 9998 4a3c388f8c69
child 10000 16f49d671c7f
equal deleted inserted replaced
9998:4a3c388f8c69 9999:f91e5630ce7e
     1 {header}
       
     2 <title>{repo|escape}: revision graph</title>
       
     3 <link rel="alternate" type="application/atom+xml"
       
     4    href="{url}atom-log" title="Atom feed for {repo|escape}: log" />
       
     5 <link rel="alternate" type="application/rss+xml"
       
     6    href="{url}rss-log" title="RSS feed for {repo|escape}: log" />
       
     7 <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
       
     8 </head>
       
     9 <body>
       
    10 
       
    11 <div class="container">
       
    12 <div class="menu">
       
    13 <div class="logo">
       
    14 <a href="http://mercurial.selenic.com/">
       
    15 <img src="{staticurl}hglogo.png" alt="mercurial" /></a>
       
    16 </div>
       
    17 <ul>
       
    18 <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
       
    19 <li class="active">graph</li>
       
    20 <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
       
    21 <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
       
    22 </ul>
       
    23 <ul>
       
    24 <li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
       
    25 <li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
       
    26 </ul>
       
    27 </div>
       
    28 
       
    29 <div class="main">
       
    30 <h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
       
    31 <h3>graph</h3>
       
    32 
       
    33 <form class="search" action="{url}log">
       
    34 {sessionvars%hiddenformentry}
       
    35 <p><input name="rev" id="search1" type="text" size="30" /></p>
       
    36 <div id="hint">find changesets by author, revision,
       
    37 files, or words in the commit message</div>
       
    38 </form>
       
    39 
       
    40 <div class="navigate">
       
    41 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
       
    42 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
       
    43 | rev {rev}: {changenav%navgraphentry}
       
    44 </div>
       
    45 
       
    46 <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript>
       
    47 
       
    48 <div id="wrapper">
       
    49 <ul id="nodebgs"></ul>
       
    50 <canvas id="graph" width="224" height="{canvasheight}"></canvas>
       
    51 <ul id="graphnodes"></ul>
       
    52 </div>
       
    53 
       
    54 <script type="text/javascript" src="{staticurl}graph.js"></script>
       
    55 <script type="text/javascript">
       
    56 <!-- hide script content
       
    57 
       
    58 var data = {jsdata|json};
       
    59 var graph = new Graph();
       
    60 graph.scale({bg_height});
       
    61 
       
    62 graph.edge = function(x0, y0, x1, y1, color) {
       
    63 	
       
    64 	this.setColor(color, 0.0, 0.65);
       
    65 	this.ctx.beginPath();
       
    66 	this.ctx.moveTo(x0, y0);
       
    67 	this.ctx.lineTo(x1, y1);
       
    68 	this.ctx.stroke();
       
    69 	
       
    70 }
       
    71 
       
    72 var revlink = '<li style="_STYLE"><span class="desc">';
       
    73 revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
       
    74 revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>';
       
    75 
       
    76 graph.vertex = function(x, y, color, parity, cur) {
       
    77 	
       
    78 	this.ctx.beginPath();
       
    79 	color = this.setColor(color, 0.25, 0.75);
       
    80 	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
       
    81 	this.ctx.fill();
       
    82 	
       
    83 	var bg = '<li class="bg parity' + parity + '"></li>';
       
    84 	var left = (this.columns + 1) * this.bg_height;
       
    85 	var nstyle = 'padding-left: ' + left + 'px;';
       
    86 	var item = revlink.replace(/_STYLE/, nstyle);
       
    87 	item = item.replace(/_PARITY/, 'parity' + parity);
       
    88 	item = item.replace(/_NODEID/, cur[0]);
       
    89 	item = item.replace(/_NODEID/, cur[0]);
       
    90 	item = item.replace(/_DESC/, cur[3]);
       
    91 	item = item.replace(/_USER/, cur[4]);
       
    92 	item = item.replace(/_DATE/, cur[5]);
       
    93 
       
    94 	var tagspan = '';
       
    95 	if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
       
    96 		tagspan = '<span class="logtags">';
       
    97 		if (cur[6][1]) {
       
    98 			tagspan += '<span class="branchhead" title="' + cur[6][0] + '">';
       
    99 			tagspan += cur[6][0] + '</span> ';
       
   100 		} else if (!cur[6][1] && cur[6][0] != 'default') {
       
   101 			tagspan += '<span class="branchname" title="' + cur[6][0] + '">';
       
   102 			tagspan += cur[6][0] + '</span> ';
       
   103 		}
       
   104 		if (cur[7].length) {
       
   105 			for (var t in cur[7]) {
       
   106 				var tag = cur[7][t];
       
   107 				tagspan += '<span class="tag">' + tag + '</span> ';
       
   108 			}
       
   109 		}
       
   110 		tagspan += '</span>';
       
   111 	}
       
   112 	
       
   113 	item = item.replace(/_TAGS/, tagspan);
       
   114 	return [bg, item];
       
   115 	
       
   116 }
       
   117 
       
   118 graph.render(data);
       
   119 
       
   120 // stop hiding script -->
       
   121 </script>
       
   122 
       
   123 <div class="navigate">
       
   124 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
       
   125 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
       
   126 | rev {rev}: {changenav%navgraphentry}
       
   127 </div>
       
   128 
       
   129 </div>
       
   130 </div>
       
   131 
       
   132 {footer}