Changeset - 46d42b34cf3e
[Not reviewed]
default
0 2 0
Sean Farley - 11 years ago 2014-07-09 21:09:19
sean.michael.farley@gmail.com
graph: draw edges to obsolete changesets as dashed
2 files changed with 17 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/graphmod.py
Show inline comments
 
@@ -103,6 +103,7 @@ def _colored(repo, dag):
 

	
 
    row = []
 
    colors = {}
 
    obs = {}
 
    newcolor = 1
 

	
 
    for (rev, dagparents) in dag:
 
@@ -111,6 +112,7 @@ def _colored(repo, dag):
 
        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 @@ def _colored(repo, dag):
 
                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 @@ def _colored(repo, dag):
 
        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)
kallithea/public/js/graph.js
Show inline comments
 
@@ -115,6 +115,7 @@ function BranchRenderer(canvas_id, conte
 
				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 @@ function BranchRenderer(canvas_id, conte
 
				
 
				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 @@ function BranchRenderer(canvas_id, conte
 
				{
 
					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];
0 comments (0 inline, 0 general)