changeset 5348:46d42b34cf3e

graph: draw edges to obsolete changesets as dashed
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 09 Jul 2014 14:09:19 -0500
parents 64659280e466
children 2978928a95ea
files kallithea/lib/graphmod.py kallithea/public/js/graph.js
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/graphmod.py	Wed Jul 09 00:35:54 2014 -0500
+++ b/kallithea/lib/graphmod.py	Wed Jul 09 14:09:19 2014 -0500
@@ -103,6 +103,7 @@
 
     row = []
     colors = {}
+    obs = {}
     newcolor = 1
 
     for (rev, dagparents) in dag:
@@ -111,6 +112,7 @@
         if rev not in row:
             row.append(rev)  # new head
             colors[rev] = newcolor
+            obs[rev] = int(repo[rev].obsolete)
             newcolor += 1
 
         col = row.index(rev)
@@ -126,12 +128,14 @@
                 nextrow.append(r)
             else:
                 colors.pop(r)
+                obs.pop(r)
 
         # Set colors for the parents
         color = colors.pop(rev)
         if addparents:
             b = branch(rev)
             for p in reversed(addparents):
+                obs[p] = int(repo[p].obsolete)
                 if b and branch(abs(p)) == b:
                     colors[p] = color
                     b = None
@@ -143,10 +147,10 @@
         edges = []
         for ecol, ep in enumerate(row):
             if ep in nextrow:
-                edges.append((ecol, nextrow.index(ep), colors[ep]))
+                edges.append((ecol, nextrow.index(ep), colors[ep], obs[ep]))
             elif ep == rev:
                 for p in dagparents:
-                    edges.append((ecol, nextrow.index(p), colors[p]))
+                    edges.append((ecol, nextrow.index(p), colors[p], obs[p]))
 
         # Yield and move on
         closing = int(repo[rev].closesbranch)
--- a/kallithea/public/js/graph.js	Wed Jul 09 00:35:54 2014 -0500
+++ b/kallithea/public/js/graph.js	Wed Jul 09 14:09:19 2014 -0500
@@ -115,6 +115,7 @@
 				start = line[0];
 				end = line[1];
 				color = line[2];
+				obsolete_line = line[3];
 				
 				x = Math.floor(base_x - box_size * start);
 
@@ -159,6 +160,11 @@
 				
 				this.ctx.lineWidth=this.line_width;
 				this.ctx.beginPath();
+				if (obsolete_line)
+				{
+					this.ctx.setLineDash([5]);
+				}
+				this.ctx.beginPath();
 				this.ctx.moveTo(x, rowY);
 				if (start == end)
 				{
@@ -168,9 +174,14 @@
 				{
 					var x2 = Math.floor(base_x - box_size * end);
 					var ymid = (rowY+nextY) / 2;
+					if (obsolete_node)
+					{
+						this.ctx.setLineDash([5]);
+					}
 					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
 				}
 				this.ctx.stroke();
+				this.ctx.setLineDash([]); // reset the dashed line, if any
 			}
 			
 			column = node[0];