Defect #11612

Revision graph sometimes broken due to raphael.js error

Added by Daniel Ritz 9 months ago. Updated 8 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:SCM
Target version:2.1.0
Affected version:2.0.3 Resolution:Fixed

Description

In most Git repositories here, the revision graph is sometimes not completely rendered, some (or even most) lines and dots are missing. I tried it in FF 14 and Safari 6 with the same result.

Firefox error console shows this:

Timestamp: 2012-08-09 11:03:52 
Error: TypeError: b[0] is undefined
Source File: http://naft02.ch.alcatel-lucent.com/redmine/javascripts/raphael.js?1342787109
Line: 7

Since revision_graph.js does not use any of the deprecated API of Raphaël 2.1, I tried updating Raphaël:

cd public/javascripts
mv raphael.js{,.old}
wget -O raphael.js https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael-min.js

This completely fixes the problem.

Associated revisions

Revision 10369
Added by Jean-Philippe Lang 8 months ago

Revision graph sometimes broken (#11612).

History

#1 Updated by Daniel Ritz 9 months ago

Spoke too soon. Found another case where things are not drawn. Turns out the problem is the missing "space" property of some of the commits. I'll check the root case later. Meanwhile the quick fix in revision_graph.js is this:

diff --git a/public/javascripts/revision_graph.js b/public/javascripts/revision_graph.js
index 31aacd8..92fb7ab 100644
--- a/public/javascripts/revision_graph.js
+++ b/public/javascripts/revision_graph.js
@@ -41,6 +41,9 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {

     commits.each(function(commit) {

+        if (!commit.hasOwnProperty("space"))
+            commit.space = 0;
+
         y = commit_table_rows[max_rdmid - commit.rdmid].getLayout().get('top') - graph_y_offset + CIRCLE_INROW_OFFSET;
         x = graph_x_offset + XSTEP / 2 + XSTEP * commit.space;

@@ -55,6 +58,9 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {
             parent_commit = commits_by_scmid.get(parent_scmid);

             if (parent_commit) {
+                if (!parent_commit.hasOwnProperty("space"))
+                    parent_commit.space = 0;
+
                 parent_y = commit_table_rows[max_rdmid - parent_commit.rdmid].getLayout().get('top') - graph_y_offset + CIRCLE_INROW_OFFSET;
                 parent_x = graph_x_offset + XSTEP / 2 + XSTEP * parent_commit.space;

#2 Updated by Jean-Philippe Lang 8 months ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.1.0
  • Resolution set to Fixed

Patch applied in r10369. Thanks.

#3 Updated by Etienne Massip 8 months ago

Not sure forcing the space to 0 has no side-effect, the problem might also be in the commit data.

#4 Updated by Jean-Philippe Lang 8 months ago

The space property is supposed to be numeric so setting it to 0 if it's undefined can't be bad.

#5 Updated by Jean-Philippe Lang 8 months ago

  • Status changed from Resolved to Closed

Merged.

#6 Updated by Etienne Massip 8 months ago

Jean-Philippe Lang wrote:

The space property is supposed to be numeric so setting it to 0 if it's undefined can't be bad.

IIRC it means forcing the position of the commit on the first displayed branch which is not necessarily correct, that's all my concern.

As Daniel says, having this property unset probably hides some deeper cause.

#7 Updated by Jean-Philippe Lang 8 months ago

As Daniel says, having this property unset probably hides some deeper cause.

Sure, but his patch fixes his problem. Just some kind of workaround until someone actually fixes the root cause.

#8 Updated by John Kubiatowicz 8 months ago

I am seeing this problem on 1.4 stable branch as well.

Any chance of a back-ported fix?

Also available in: Atom PDF