BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0d967bce
Unverified
Commit
0d967bce
authored
Oct 01, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show additions/deletions stats on merge request diff
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
8e05ee36
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
19 deletions
+37
-19
CHANGELOG
CHANGELOG
+1
-0
_diffs.html.haml
app/views/projects/diffs/_diffs.html.haml
+6
-3
_stats.html.haml
app/views/projects/diffs/_stats.html.haml
+14
-16
file.rb
lib/gitlab/diff/file.rb
+8
-0
line.rb
lib/gitlab/diff/line.rb
+8
-0
No files found.
CHANGELOG
View file @
0d967bce
...
...
@@ -21,6 +21,7 @@ v 8.1.0 (unreleased)
- Fix bug when removed file was not appearing in merge request diff
- Note the original location of a moved project when notifying users of the move
- Improve error message when merging fails
- 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
View file @
0d967bce
-
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
)
-
additions
=
diff_files
.
sum
(
&
:added_lines
)
-
deletions
=
diff_files
.
sum
(
&
:removed_lines
)
=
render
'projects/diffs/stats'
,
diff_files:
diff_files
,
additions:
additions
,
deletions:
deletions
-
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
View file @
0d967bce
...
...
@@ -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
#{
additions
}
additions
and
%strong
.cred
#{
deletions
}
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
View file @
0d967bce
...
...
@@ -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
View file @
0d967bce
...
...
@@ -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
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