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
38fce3de
Commit
38fce3de
authored
Feb 27, 2013
by
Sato Hiroyuki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
It improves detecting an overlap of a line
parent
f11e855b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
15 deletions
+31
-15
app/models/graph/commit.rb
app/models/graph/commit.rb
+11
-3
app/models/graph/json_builder.rb
app/models/graph/json_builder.rb
+20
-12
No files found.
app/models/graph/commit.rb
View file @
38fce3de
...
...
@@ -4,12 +4,12 @@ module Graph
class
Commit
include
ActionView
::
Helpers
::
TagHelper
attr_accessor
:time
,
:space
,
:refs
,
:parent_spaces
attr_accessor
:time
,
:space
s
,
:refs
,
:parent_spaces
def
initialize
(
commit
)
@_commit
=
commit
@time
=
-
1
@space
=
0
@space
s
=
[]
@parent_spaces
=
[]
end
...
...
@@ -27,7 +27,7 @@ module Graph
email:
author
.
email
}
h
[
:time
]
=
time
h
[
:space
]
=
space
h
[
:space
]
=
space
s
.
first
h
[
:parent_spaces
]
=
parent_spaces
h
[
:refs
]
=
refs
.
collect
{
|
r
|
r
.
name
}.
join
(
" "
)
unless
refs
.
nil?
h
[
:id
]
=
sha
...
...
@@ -46,5 +46,13 @@ module Graph
@refs
=
ref_cache
[
@_commit
.
id
]
if
ref_cache
.
include?
(
@_commit
.
id
)
@refs
||=
[]
end
def
space
if
@spaces
.
size
>
0
@spaces
.
first
else
0
end
end
end
end
app/models/graph/json_builder.rb
View file @
38fce3de
...
...
@@ -151,7 +151,7 @@ module Graph
def
find_free_parent_space
(
range
,
space_base
,
space_step
,
space_default
,
times
)
if
is_overlap?
(
range
,
times
,
space_default
)
then
find_free_space
(
range
,
space_
base
,
space_step
,
space_default
)
find_free_space
(
range
,
space_
step
,
space_base
,
space_default
)
else
space_default
end
...
...
@@ -161,7 +161,7 @@ module Graph
range
.
each
do
|
i
|
if
i
!=
range
.
first
&&
i
!=
range
.
last
&&
times
[
i
].
space
==
overlap_space
then
times
[
i
].
space
s
.
include?
(
overlap_space
)
then
return
true
;
end
...
...
@@ -179,9 +179,24 @@ module Graph
if
leaves
.
empty?
return
end
time_range
=
leaves
.
last
.
time
..
leaves
.
first
.
time
space
=
find_free_space
(
time_range
,
2
)
leaves
.
each
do
|
l
|
l
.
spaces
<<
space
# Also add space to parent
l
.
parents
.
each
do
|
p
|
if
map
.
include?
(
p
.
id
)
parent
=
map
[
p
.
id
]
if
parent
.
space
>
0
parent
.
spaces
<<
space
end
end
end
end
# and mark it as reserved
min_time
=
leaves
.
last
.
time
max_space
=
1
parents
=
leaves
.
last
.
parents
.
collect
parents
.
each
do
|
p
|
if
map
.
include?
p
.
id
...
...
@@ -189,21 +204,14 @@ module Graph
if
parent
.
time
<
min_time
min_time
=
parent
.
time
end
if
max_space
<
parent
.
space
then
max_space
=
parent
.
space
end
end
end
if
parent_time
.
nil?
max_time
=
leaves
.
first
.
time
else
max_time
=
parent_time
-
1
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
)
# Visit branching chains
...
...
@@ -221,7 +229,7 @@ module Graph
end
end
def
find_free_space
(
time_range
,
space_
base
,
space_step
,
space_default
=
1
)
def
find_free_space
(
time_range
,
space_
step
,
space_base
=
1
,
space_default
=
1
)
reserved
=
[]
for
day
in
time_range
reserved
+=
@_reserved
[
day
]
...
...
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