Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e0609a78
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,发现更多精彩内容 >>
提交
e0609a78
编写于
10月 01, 2015
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'show-diff-stats-for-mr'
上级
958e727f
e2576d58
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
19 deletion
+34
-19
CHANGELOG
CHANGELOG
+1
-0
app/views/projects/diffs/_diffs.html.haml
app/views/projects/diffs/_diffs.html.haml
+3
-3
app/views/projects/diffs/_stats.html.haml
app/views/projects/diffs/_stats.html.haml
+14
-16
lib/gitlab/diff/file.rb
lib/gitlab/diff/file.rb
+8
-0
lib/gitlab/diff/line.rb
lib/gitlab/diff/line.rb
+8
-0
未找到文件。
CHANGELOG
浏览文件 @
e0609a78
...
...
@@ -23,6 +23,7 @@ v 8.1.0 (unreleased)
- Note the original location of a moved project when notifying users of the move
- Improve error message when merging fails
- Add support of multibyte characters in LDAP UID (Roman Petrov)
- Show additions/deletions stats on merge request diff
v 8.0.3
- Fix URL shown in Slack notifications
...
...
app/views/projects/diffs/_diffs.html.haml
浏览文件 @
e0609a78
-
if
params
[
:view
]
==
'parallel'
-
fluid_layout
true
-
diff_files
=
safe_diff_files
(
diffs
)
.gray-content-block.second-block
.inline-parallel-buttons
.btn-group
=
inline_diff_btn
=
parallel_diff_btn
=
render
'projects/diffs/stats'
,
diffs:
diffs
-
diff_files
=
safe_diff_files
(
diffs
)
=
render
'projects/diffs/stats'
,
diff_files:
diff_files
-
if
diff_files
.
count
<
diffs
.
size
=
render
'projects/diffs/warning'
,
diffs:
diffs
,
shown_files_count:
diff_files
.
count
...
...
app/views/projects/diffs/_stats.html.haml
浏览文件 @
e0609a78
...
...
@@ -2,37 +2,35 @@
.commit-stat-summary
Showing
=
link_to
'#'
,
class:
'js-toggle-button'
do
%strong
#{
pluralize
(
diffs
.
count
,
"changed file"
)
}
-
if
current_controller?
(
:commit
)
-
unless
@commit
.
has_zero_stats?
with
%strong
.cgreen
#{
@commit
.
stats
.
additions
}
additions
and
%strong
.cred
#{
@commit
.
stats
.
deletions
}
deletions
%strong
#{
pluralize
(
diff_files
.
count
,
"changed file"
)
}
with
%strong
.cgreen
#{
diff_files
.
sum
(
&
:added_lines
)
}
additions
and
%strong
.cred
#{
diff_files
.
sum
(
&
:removed_lines
)
}
deletions
.file-stats.js-toggle-content.hide
%ul
-
diff
s
.
each_with_index
do
|
diff
,
i
|
-
diff
_files
.
each_with_index
do
|
diff_file
,
i
|
%li
-
if
diff
.
deleted_file
-
if
diff
_file
.
deleted_file
%span
.deleted-file
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-minus
=
diff
.
old_path
-
elsif
diff
.
renamed_file
=
diff
_file
.
old_path
-
elsif
diff
_file
.
renamed_file
%span
.renamed-file
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-minus
=
diff
.
old_path
=
diff
_file
.
old_path
→
=
diff
.
new_path
-
elsif
diff
.
new_file
=
diff
_file
.
new_path
-
elsif
diff
_file
.
new_file
%span
.new-file
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-plus
=
diff
.
new_path
=
diff
_file
.
new_path
-
else
%span
.edit-file
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-adjust
=
diff
.
new_path
=
diff
_file
.
new_path
lib/gitlab/diff/file.rb
浏览文件 @
e0609a78
...
...
@@ -44,6 +44,14 @@ module Gitlab
diff
.
old_path
end
end
def
added_lines
diff_lines
.
select
(
&
:added?
).
size
end
def
removed_lines
diff_lines
.
select
(
&
:removed?
).
size
end
end
end
end
lib/gitlab/diff/line.rb
浏览文件 @
e0609a78
...
...
@@ -7,6 +7,14 @@ module Gitlab
@text
,
@type
,
@index
=
text
,
type
,
index
@old_pos
,
@new_pos
=
old_pos
,
new_pos
end
def
added?
type
==
'new'
end
def
removed?
type
==
'old'
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录