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
6f7a3ee6
Commit
6f7a3ee6
authored
Sep 07, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor merge request version compare feature
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5f0535ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-6
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+4
-0
app/views/projects/merge_requests/show/_versions.html.haml
app/views/projects/merge_requests/show/_versions.html.haml
+5
-3
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
6f7a3ee6
...
@@ -542,7 +542,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -542,7 +542,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
compared_diff_version
def
compared_diff_version
compare
=
CompareService
.
new
.
execute
(
@project
,
@merge_request_diff
.
head_commit_sha
,
@project
,
@start_sha
)
compare
=
@merge_request_diff
.
compare_with
(
@start_sha
)
if
compare
if
compare
@diffs
=
compare
.
diffs
(
diff_options
)
@diffs
=
compare
.
diffs
(
diff_options
)
...
@@ -551,11 +551,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -551,11 +551,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
original_diff_version
def
original_diff_version
unless
@merge_request_diff
.
latest?
@diff_notes_disabled
=
!
@merge_request_diff
.
latest?
# Disable comments if browsing older version of the diff
@diff_notes_disabled
=
true
end
@diffs
=
@merge_request_diff
.
diffs
(
diff_options
)
@diffs
=
@merge_request_diff
.
diffs
(
diff_options
)
end
end
end
end
app/models/merge_request_diff.rb
View file @
6f7a3ee6
...
@@ -152,6 +152,10 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -152,6 +152,10 @@ class MergeRequestDiff < ActiveRecord::Base
self
==
merge_request
.
merge_request_diff
self
==
merge_request
.
merge_request_diff
end
end
def
compare_with
(
sha
)
CompareService
.
new
.
execute
(
project
,
head_commit_sha
,
project
,
sha
)
end
private
private
def
dump_commits
(
commits
)
def
dump_commits
(
commits
)
...
...
app/views/projects/merge_requests/show/_versions.html.haml
View file @
6f7a3ee6
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
=
time_ago_with_tooltip
(
merge_request_diff
.
created_at
)
=
time_ago_with_tooltip
(
merge_request_diff
.
created_at
)
-
if
@merge_request_diff
.
base_commit_sha
-
if
@merge_request_diff
.
base_commit_sha
and
and
%span
.dropdown.inline.mr-version-compare-dropdown
%span
.dropdown.inline.mr-version-compare-dropdown
%a
.btn-link.dropdown-toggle
{
data:
{
toggle: :dropdown
}
}
%a
.btn-link.dropdown-toggle
{
data:
{
toggle: :dropdown
}
}
%strong
%strong
...
@@ -51,8 +51,10 @@
...
@@ -51,8 +51,10 @@
#{
@merge_request
.
target_branch
}
(base)
#{
@merge_request
.
target_branch
}
(base)
.monospace
#{
short_sha
(
@merge_request_diff
.
base_commit_sha
)
}
.monospace
#{
short_sha
(
@merge_request_diff
.
base_commit_sha
)
}
-
unless
@merge_request_diff
.
latest?
&&
!
@start_sha
-
unless
@merge_request_diff
.
latest?
&&
!
@start_sha
.prepend-top-10
.prepend-top-10
=
icon
(
'info-circle'
)
=
icon
(
'info-circle'
)
Comments are disabled while viewing outdated merge versions or comparing to versions other than base.
-
if
@start_sha
Comments are disabled because you're comparing two versions of this merge request.
-
else
Comments are disabled because you're viewing an old version of this merge request.
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