# HG changeset patch # User Mads Kiilerich # Date 2014-07-18 18:44:54 # Node ID b3dd9cc3a035369776122668971390eff559e02b # Parent 493f5f62be1898276596ee248c74bf0c7f2de548 graph: show branch close markers diff --git a/kallithea/lib/graphmod.py b/kallithea/lib/graphmod.py --- a/kallithea/lib/graphmod.py +++ b/kallithea/lib/graphmod.py @@ -149,5 +149,6 @@ def _colored(repo, dag): edges.append((ecol, nextrow.index(p), colors[p])) # Yield and move on - yield ((col, color), edges) + closing = int(repo[rev].closesbranch) + yield ((col, color), edges, closing) 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 @@ -663,6 +663,9 @@ class BaseChangeset(object): data['removed'] = [node.path for node in self.removed] return data + @LazyProperty + def closesbranch(self): + return False class BaseWorkdir(object): """ 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 @@ -38,6 +38,10 @@ class MercurialChangeset(BaseChangeset): return safe_unicode(self._ctx.branch()) @LazyProperty + def closesbranch(self): + return self._ctx.closesbranch() + + @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 @@ -36,6 +36,8 @@ function BranchRenderer(canvas_id, conte this.cur = [0, 0]; this.line_width = 2.0; this.dot_radius = 3.5; + this.close_x = 1.5 * this.dot_radius; + this.close_y = 0.5 * this.dot_radius; this.calcColor = function(color, bg, fg) { color %= colors.length; @@ -86,6 +88,7 @@ function BranchRenderer(canvas_id, conte cur = data[i]; node = cur[0]; in_l = cur[1]; + closing = cur[2]; var rowY = row.offsetTop + row.offsetHeight/2 - rela.offsetTop; var nextY = (next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + next.offsetHeight/2 - rela.offsetTop; @@ -156,15 +159,20 @@ function BranchRenderer(canvas_id, conte column = node[0]; color = node[1]; - radius = this.dot_radius; - x = base_x - box_size * column; - this.ctx.beginPath(); this.setColor(color, 0.25, 0.75); - this.ctx.arc(x, rowY, radius, 0, Math.PI * 2, true); - this.ctx.fill(); - + if (closing) + { + this.ctx.fillRect(x - this.close_x, rowY - this.close_y, 2*this.close_x, 2*this.close_y); + } + else + { + this.ctx.beginPath(); + this.ctx.arc(x, rowY, this.dot_radius, 0, Math.PI * 2, true); + this.ctx.fill(); + } + idx++; }