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
Boxiang Sun
gitlab-ce
Commits
e0609a78
Commit
e0609a78
authored
Oct 01, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'show-diff-stats-for-mr'
parents
958e727f
e2576d58
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
19 deletions
+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
No files found.
CHANGELOG
View file @
e0609a78
...
@@ -23,6 +23,7 @@ v 8.1.0 (unreleased)
...
@@ -23,6 +23,7 @@ v 8.1.0 (unreleased)
- Note the original location of a moved project when notifying users of the move
- Note the original location of a moved project when notifying users of the move
- Improve error message when merging fails
- Improve error message when merging fails
- Add support of multibyte characters in LDAP UID (Roman Petrov)
- Add support of multibyte characters in LDAP UID (Roman Petrov)
- Show additions/deletions stats on merge request diff
v 8.0.3
v 8.0.3
- Fix URL shown in Slack notifications
- Fix URL shown in Slack notifications
...
...
app/views/projects/diffs/_diffs.html.haml
View file @
e0609a78
-
if
params
[
:view
]
==
'parallel'
-
if
params
[
:view
]
==
'parallel'
-
fluid_layout
true
-
fluid_layout
true
-
diff_files
=
safe_diff_files
(
diffs
)
.gray-content-block.second-block
.gray-content-block.second-block
.inline-parallel-buttons
.inline-parallel-buttons
.btn-group
.btn-group
=
inline_diff_btn
=
inline_diff_btn
=
parallel_diff_btn
=
parallel_diff_btn
=
render
'projects/diffs/stats'
,
diffs:
diffs
=
render
'projects/diffs/stats'
,
diff_files:
diff_files
-
diff_files
=
safe_diff_files
(
diffs
)
-
if
diff_files
.
count
<
diffs
.
size
-
if
diff_files
.
count
<
diffs
.
size
=
render
'projects/diffs/warning'
,
diffs:
diffs
,
shown_files_count:
diff_files
.
count
=
render
'projects/diffs/warning'
,
diffs:
diffs
,
shown_files_count:
diff_files
.
count
...
...
app/views/projects/diffs/_stats.html.haml
View file @
e0609a78
...
@@ -2,37 +2,35 @@
...
@@ -2,37 +2,35 @@
.commit-stat-summary
.commit-stat-summary
Showing
Showing
=
link_to
'#'
,
class:
'js-toggle-button'
do
=
link_to
'#'
,
class:
'js-toggle-button'
do
%strong
#{
pluralize
(
diffs
.
count
,
"changed file"
)
}
%strong
#{
pluralize
(
diff_files
.
count
,
"changed file"
)
}
-
if
current_controller?
(
:commit
)
-
unless
@commit
.
has_zero_stats?
with
with
%strong
.cgreen
#{
@commit
.
stats
.
additions
}
additions
%strong
.cgreen
#{
diff_files
.
sum
(
&
:added_lines
)
}
additions
and
and
%strong
.cred
#{
@commit
.
stats
.
deletions
}
deletions
%strong
.cred
#{
diff_files
.
sum
(
&
:removed_lines
)
}
deletions
.file-stats.js-toggle-content.hide
.file-stats.js-toggle-content.hide
%ul
%ul
-
diff
s
.
each_with_index
do
|
diff
,
i
|
-
diff
_files
.
each_with_index
do
|
diff_file
,
i
|
%li
%li
-
if
diff
.
deleted_file
-
if
diff
_file
.
deleted_file
%span
.deleted-file
%span
.deleted-file
%a
{
href:
"#diff-#{i}"
}
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-minus
%i
.fa.fa-minus
=
diff
.
old_path
=
diff
_file
.
old_path
-
elsif
diff
.
renamed_file
-
elsif
diff
_file
.
renamed_file
%span
.renamed-file
%span
.renamed-file
%a
{
href:
"#diff-#{i}"
}
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-minus
%i
.fa.fa-minus
=
diff
.
old_path
=
diff
_file
.
old_path
→
→
=
diff
.
new_path
=
diff
_file
.
new_path
-
elsif
diff
.
new_file
-
elsif
diff
_file
.
new_file
%span
.new-file
%span
.new-file
%a
{
href:
"#diff-#{i}"
}
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-plus
%i
.fa.fa-plus
=
diff
.
new_path
=
diff
_file
.
new_path
-
else
-
else
%span
.edit-file
%span
.edit-file
%a
{
href:
"#diff-#{i}"
}
%a
{
href:
"#diff-#{i}"
}
%i
.fa.fa-adjust
%i
.fa.fa-adjust
=
diff
.
new_path
=
diff
_file
.
new_path
lib/gitlab/diff/file.rb
View file @
e0609a78
...
@@ -44,6 +44,14 @@ module Gitlab
...
@@ -44,6 +44,14 @@ module Gitlab
diff
.
old_path
diff
.
old_path
end
end
end
end
def
added_lines
diff_lines
.
select
(
&
:added?
).
size
end
def
removed_lines
diff_lines
.
select
(
&
:removed?
).
size
end
end
end
end
end
end
end
lib/gitlab/diff/line.rb
View file @
e0609a78
...
@@ -7,6 +7,14 @@ module Gitlab
...
@@ -7,6 +7,14 @@ module Gitlab
@text
,
@type
,
@index
=
text
,
type
,
index
@text
,
@type
,
@index
=
text
,
type
,
index
@old_pos
,
@new_pos
=
old_pos
,
new_pos
@old_pos
,
@new_pos
=
old_pos
,
new_pos
end
end
def
added?
type
==
'new'
end
def
removed?
type
==
'old'
end
end
end
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