[PATCH 1 of 6] graph: show obsolete changesets with an 'X'

Andrew Shadura andrew at shadura.me
Tue Jul 28 11:02:37 UTC 2015


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1404884154 18000
#      Wed Jul 09 00:35:54 2014 -0500
# Node ID 011e77e80ae34ba9a19b8591c78959feee5934b9
# Parent  82faecc2132459bf0ba2717f2178ce6b3672e268
graph: show obsolete changesets with an 'X'

diff --git a/kallithea/lib/graphmod.py b/kallithea/lib/graphmod.py
--- a/kallithea/lib/graphmod.py
+++ b/kallithea/lib/graphmod.py
@@ -150,5 +150,6 @@ def _colored(repo, dag):
 
         # Yield and move on
         closing = int(repo[rev].closesbranch)
-        yield ((col, color), edges, closing)
+        obsolete = int(repo[rev].obsolete)
+        yield ((col, color), edges, closing, obsolete)
         row = nextrow
diff --git a/kallithea/lib/vcs/backends/base.py b/kallithea/lib/vcs/backends/base.py
--- a/kallithea/lib/vcs/backends/base.py
+++ b/kallithea/lib/vcs/backends/base.py
@@ -667,6 +667,10 @@ class BaseChangeset(object):
     def closesbranch(self):
         return False
 
+    @LazyProperty
+    def obsolete(self):
+        return False
+
 class BaseWorkdir(object):
     """
     Working directory representation of single repository.
diff --git a/kallithea/lib/vcs/backends/hg/changeset.py b/kallithea/lib/vcs/backends/hg/changeset.py
--- a/kallithea/lib/vcs/backends/hg/changeset.py
+++ b/kallithea/lib/vcs/backends/hg/changeset.py
@@ -43,6 +43,10 @@ class MercurialChangeset(BaseChangeset):
         return  self._ctx.closesbranch()
 
     @LazyProperty
+    def obsolete(self):
+        return  self._ctx.obsolete()
+
+    @LazyProperty
     def bookmarks(self):
         return map(safe_unicode, self._ctx.bookmarks())
 
diff --git a/kallithea/public/js/graph.js b/kallithea/public/js/graph.js
--- a/kallithea/public/js/graph.js
+++ b/kallithea/public/js/graph.js
@@ -105,6 +105,7 @@ function BranchRenderer(canvas_id, conte
 			node = cur[0];
 			in_l = cur[1];
 			closing = cur[2];
+			obsolete_node = cur[3];
 
 			var rowY = row.offsetTop + row.offsetHeight/2;
 			var nextY = (next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + next.offsetHeight/2;
@@ -178,6 +179,19 @@ function BranchRenderer(canvas_id, conte
 			x = Math.floor(base_x - box_size * column);
 		
 			this.setColor(color, 0.25, 0.75);
+
+
+			r = this.dot_radius
+			if (obsolete_node)
+			{
+				this.ctx.beginPath();
+				this.ctx.moveTo(x - this.close_x, rowY - this.close_y - 3);
+				this.ctx.lineTo(x - this.close_x + 2*this.close_x, rowY - this.close_y + 4*this.close_y - 1);
+				this.ctx.moveTo(x - this.close_x, rowY - this.close_y + 4*this.close_y - 1);
+				this.ctx.lineTo(x - this.close_x + 2*this.close_x, rowY - this.close_y - 3);
+				this.ctx.stroke();
+				r -= 0.5
+			}
 			if (closing)
 			{
 				this.ctx.fillRect(x - this.close_x, rowY - this.close_y, 2*this.close_x, 2*this.close_y);
@@ -185,7 +199,7 @@ function BranchRenderer(canvas_id, conte
 			else
 			{
 				this.ctx.beginPath();
-				this.ctx.arc(x, rowY, this.dot_radius, 0, Math.PI * 2, true);
+				this.ctx.arc(x, rowY, r, 0, Math.PI * 2, true);
 				this.ctx.fill();
 			}
 


More information about the kallithea-general mailing list