Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
38fce3de
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38fce3de
编写于
2月 27, 2013
作者:
S
Sato Hiroyuki
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
It improves detecting an overlap of a line
上级
f11e855b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
15 deletion
+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
未找到文件。
app/models/graph/commit.rb
浏览文件 @
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
浏览文件 @
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
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录