Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
41332212
Commit
41332212
authored
Jan 31, 2013
by
Sato Hiroyuki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug of network graph(#2847) and trivial code clean up.
parent
9da7b2e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
lib/gitlab/graph/json_builder.rb
lib/gitlab/graph/json_builder.rb
+15
-8
vendor/assets/javascripts/branch-graph.js
vendor/assets/javascripts/branch-graph.js
+1
-1
No files found.
lib/gitlab/graph/json_builder.rb
View file @
41332212
...
@@ -109,9 +109,9 @@ module Gitlab
...
@@ -109,9 +109,9 @@ module Gitlab
end
end
space
=
if
commit
.
space
>=
parent
.
space
then
space
=
if
commit
.
space
>=
parent
.
space
then
find_free_parent_space
(
range
,
map
,
parent
.
space
,
1
,
commit
.
space
,
times
)
find_free_parent_space
(
range
,
parent
.
space
,
1
,
commit
.
space
,
times
)
else
else
find_free_parent_space
(
range
,
map
,
parent
.
space
,
-
1
,
parent
.
space
,
times
)
find_free_parent_space
(
range
,
parent
.
space
,
-
1
,
parent
.
space
,
times
)
end
end
mark_reserved
(
range
,
space
)
mark_reserved
(
range
,
space
)
...
@@ -122,9 +122,9 @@ module Gitlab
...
@@ -122,9 +122,9 @@ module Gitlab
spaces
spaces
end
end
def
find_free_parent_space
(
range
,
map
,
space_base
,
space_step
,
space_default
,
times
)
def
find_free_parent_space
(
range
,
space_base
,
space_step
,
space_default
,
times
)
if
is_overlap?
(
range
,
times
,
space_default
)
then
if
is_overlap?
(
range
,
times
,
space_default
)
then
find_free_space
(
range
,
map
,
space_base
,
space_step
)
find_free_space
(
range
,
space_base
,
space_step
)
else
else
space_default
space_default
end
end
...
@@ -152,11 +152,9 @@ module Gitlab
...
@@ -152,11 +152,9 @@ module Gitlab
if
leaves
.
empty?
if
leaves
.
empty?
return
return
end
end
time_range
=
leaves
.
last
.
time
..
leaves
.
first
.
time
space
=
find_free_space
(
time_range
,
map
,
1
,
2
)
leaves
.
each
{
|
l
|
l
.
space
=
space
}
# and mark it as reserved
# and mark it as reserved
min_time
=
leaves
.
last
.
time
min_time
=
leaves
.
last
.
time
max_space
=
1
parents
=
leaves
.
last
.
parents
.
collect
parents
=
leaves
.
last
.
parents
.
collect
parents
.
each
do
|
p
|
parents
.
each
do
|
p
|
if
map
.
include?
p
.
id
if
map
.
include?
p
.
id
...
@@ -164,6 +162,9 @@ module Gitlab
...
@@ -164,6 +162,9 @@ module Gitlab
if
parent
.
time
<
min_time
if
parent
.
time
<
min_time
min_time
=
parent
.
time
min_time
=
parent
.
time
end
end
if
max_space
<
parent
.
space
then
max_space
=
parent
.
space
end
end
end
end
end
if
parent_time
.
nil?
if
parent_time
.
nil?
...
@@ -171,6 +172,11 @@ module Gitlab
...
@@ -171,6 +172,11 @@ module Gitlab
else
else
max_time
=
parent_time
-
1
max_time
=
parent_time
-
1
end
end
time_range
=
leaves
.
last
.
time
..
leaves
.
first
.
time
space
=
find_free_space
(
time_range
,
max_space
,
2
)
leaves
.
each
{
|
l
|
l
.
space
=
space
}
mark_reserved
(
min_time
..
max_time
,
space
)
mark_reserved
(
min_time
..
max_time
,
space
)
# Visit branching chains
# Visit branching chains
...
@@ -188,11 +194,12 @@ module Gitlab
...
@@ -188,11 +194,12 @@ module Gitlab
end
end
end
end
def
find_free_space
(
time_range
,
map
,
space_base
,
space_step
)
def
find_free_space
(
time_range
,
space_base
,
space_step
)
reserved
=
[]
reserved
=
[]
for
day
in
time_range
for
day
in
time_range
reserved
+=
@_reserved
[
day
]
reserved
+=
@_reserved
[
day
]
end
end
reserved
.
uniq!
space
=
space_base
space
=
space_base
while
reserved
.
include?
(
space
)
do
while
reserved
.
include?
(
space
)
do
...
...
vendor/assets/javascripts/branch-graph.js
View file @
41332212
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
var
cx
=
offsetX
+
20
*
c
.
time
var
cx
=
offsetX
+
20
*
c
.
time
,
cy
=
offsetY
+
10
*
c
.
space
,
cy
=
offsetY
+
10
*
c
.
space
,
psy
=
offsetY
+
10
*
ps
;
,
psy
=
offsetY
+
10
*
ps
;
if
(
c
.
space
==
this
.
commits
[
i
].
space
)
{
if
(
c
.
space
==
this
.
commits
[
i
].
space
&&
c
.
space
==
ps
)
{
r
.
path
([
r
.
path
([
"
M
"
,
x
,
y
,
"
M
"
,
x
,
y
,
"
L
"
,
cx
,
cy
"
L
"
,
cx
,
cy
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment