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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
5fd830f0
Commit
5fd830f0
authored
Dec 12, 2012
by
Sato Hiroyuki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve network-graph
parent
743073ce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
lib/gitlab/graph/json_builder.rb
lib/gitlab/graph/json_builder.rb
+20
-9
No files found.
lib/gitlab/graph/json_builder.rb
View file @
5fd830f0
...
@@ -98,7 +98,7 @@ module Gitlab
...
@@ -98,7 +98,7 @@ module Gitlab
if
leaves
.
empty?
if
leaves
.
empty?
return
return
end
end
space
=
find_free_space
(
leaves
.
last
.
time
..
leaves
.
first
.
time
)
space
=
find_free_space
(
leaves
,
map
)
leaves
.
each
{
|
l
|
l
.
space
=
space
}
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
...
@@ -120,7 +120,7 @@ module Gitlab
...
@@ -120,7 +120,7 @@ module Gitlab
# Visit branching chains
# Visit branching chains
leaves
.
each
do
|
l
|
leaves
.
each
do
|
l
|
parents
=
l
.
parents
.
collect
.
select
{
|
p
|
map
.
include?
p
.
id
and
map
[
p
.
id
].
space
==
0
}
parents
=
l
.
parents
.
collect
.
select
{
|
p
|
map
.
include?
p
.
id
and
map
[
p
.
id
].
space
.
zero?
}
for
p
in
parents
for
p
in
parents
place_chain
(
map
[
p
.
id
],
map
,
l
.
time
)
place_chain
(
map
[
p
.
id
],
map
,
l
.
time
)
end
end
...
@@ -133,18 +133,29 @@ module Gitlab
...
@@ -133,18 +133,29 @@ module Gitlab
end
end
end
end
def
find_free_space
(
time_range
)
def
find_free_space
(
leaves
,
map
)
time_range
=
leaves
.
last
.
time
..
leaves
.
first
.
time
reserved
=
[]
reserved
=
[]
for
day
in
time_range
for
day
in
time_range
reserved
+=
@_reserved
[
day
]
reserved
+=
@_reserved
[
day
]
end
end
space
=
1
space
=
base_space
(
leaves
,
map
)
while
reserved
.
include?
space
do
while
reserved
.
include?
space
do
space
+=
1
space
+=
1
end
end
space
space
end
end
def
base_space
(
leaves
,
map
)
parents
=
[]
leaves
.
each
do
|
l
|
parents
.
concat
l
.
parents
.
collect
.
select
{
|
p
|
map
.
include?
p
.
id
and
map
[
p
.
id
].
space
.
nonzero?
}
end
space
=
parents
.
map
{
|
p
|
map
[
p
.
id
].
space
}.
max
||
0
space
+=
1
end
# Takes most left subtree branch of commits
# Takes most left subtree branch of commits
# which don't have space mark yet.
# which don't have space mark yet.
#
#
...
@@ -157,13 +168,13 @@ module Gitlab
...
@@ -157,13 +168,13 @@ module Gitlab
leaves
.
push
(
commit
)
if
commit
.
space
.
zero?
leaves
.
push
(
commit
)
if
commit
.
space
.
zero?
while
true
while
true
parent
=
commit
.
parents
.
collect
.
select
do
|
p
|
return
leaves
if
commit
.
parents
.
count
.
zero?
map
.
include?
p
.
id
and
map
[
p
.
id
].
space
==
0
return
leaves
unless
map
.
include?
commit
.
parents
.
first
.
id
end
commit
=
map
[
commit
.
parents
.
first
.
id
]
return
leaves
if
parent
.
count
.
zero?
return
leaves
unless
commit
.
space
.
zero?
commit
=
map
[
parent
.
first
.
id
]
leaves
.
push
(
commit
)
leaves
.
push
(
commit
)
end
end
end
end
...
...
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