プロジェクト

全般

プロフィール

Vote #72347

完了

Revision graph sometimes broken due to raphael.js error

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
47
issue_org_id:
11612
author_id:
48958
assigned_to_id:
1
comments:
14
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
52
ステータス-->[Closed]

説明

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.


journals

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:
<pre>
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;
</pre>
--------------------------------------------------------------------------------
Patch applied in r10369. Thanks.
--------------------------------------------------------------------------------
Not sure forcing the space to 0 has no side-effect, the problem might also be in the commit data.
--------------------------------------------------------------------------------
The space property is supposed to be numeric so setting it to 0 if it's undefined can't be bad.
--------------------------------------------------------------------------------
Merged.
--------------------------------------------------------------------------------
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.

--------------------------------------------------------------------------------
> 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.
--------------------------------------------------------------------------------
I am seeing this problem on 1.4 stable branch as well.

Any chance of a back-ported fix?
--------------------------------------------------------------------------------
We recently had the same problem - graph rendering broke completely for a repository due to JS errors because some commits were missing the @space@ property.

Turns out that on a fresh install, where the repository in question was re-imported, the problem didn't occur, because the problematic commits didnt show up at all. Further investigation showed that those commits were basically abandoned and not connected to any branch.

I think not rendering these commits in the graph at all is much better than putting them randomly on the first branch as the patch above does.

Here's the patch for 1.4:

<pre>
--- a/public/javascripts/revision_graph.js
+++ b/public/javascripts/revision_graph.js
@@ -41,6 +41,10 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {

commits.each(function(commit) {

+ if (typeof commit.space != 'undefined') {
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;

@@ -95,6 +99,7 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {
}

top.push(revision_dot_overlay);
+ }
});

top.toFront();
</pre>
--------------------------------------------------------------------------------
Jens Krämer wrote:
> We recently had the same problem - graph rendering broke completely for a repository due to JS errors because some commits were missing the @space@ property.

Could you please open a new issue for this?
--------------------------------------------------------------------------------
Etienne Massip wrote:
> Jens Krämer wrote:
> > We recently had the same problem - graph rendering broke completely for a repository due to JS errors because some commits were missing the @space@ property.
>
> Could you please open a new issue for this?

No need.
r10369 is not in version 1.4.x.

--------------------------------------------------------------------------------
Version 1.4.x Prototype and version >= 2.1 jQuery are incompatible.
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> No need.
> r10369 is not in version 1.4.x.

?

As I stated in #11612#note-6, r10369 is not a good fix.

It seems that Jens found the true reason of #11612 so he should open an issue for trunk to deal with undefined space property correctly, that is probably more like the way Jens suggested rather than erroneously attaching suspicious commits to first branch.

I didn't say the patch is ready to be applied to trunk, I just say we need to have a correct fix for this issue which is closed and fixed with a released version and, as such, can't be reopen.

--------------------------------------------------------------------------------
Opened #14116.
--------------------------------------------------------------------------------


related_issues

relates,New,14116,Don't render dot for commit which have no space property in revision graph (fine fix for #11612)

Admin Redmine さんが約4年前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン2.1.0_47 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0