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
139ff578
Commit
139ff578
authored
Dec 27, 2016
by
Sam Rose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve selected versions when comparing MR changes
parent
8dc2163c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-1
app/views/projects/merge_requests/show/_versions.html.haml
app/views/projects/merge_requests/show/_versions.html.haml
+1
-1
spec/features/merge_requests/merge_request_versions_spec.rb
spec/features/merge_requests/merge_request_versions_spec.rb
+48
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
139ff578
...
@@ -98,7 +98,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -98,7 +98,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@start_version
=
@comparable_diffs
.
find
{
|
diff
|
diff
.
head_commit_sha
==
@start_sha
}
@start_version
=
@comparable_diffs
.
find
{
|
diff
|
diff
.
head_commit_sha
==
@start_sha
}
unless
@start_version
unless
@start_version
render_404
@start_sha
=
@merge_request_diff
.
head_commit_sha
@start_version
=
@merge_request_diff
end
end
end
end
...
...
app/views/projects/merge_requests/show/_versions.html.haml
View file @
139ff578
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
%ul
%ul
-
@merge_request_diffs
.
each
do
|
merge_request_diff
|
-
@merge_request_diffs
.
each
do
|
merge_request_diff
|
%li
%li
=
link_to
merge_request_version_path
(
@project
,
@merge_request
,
merge_request_diff
),
class:
(
'is-active'
if
merge_request_diff
==
@merge_request_diff
)
do
=
link_to
merge_request_version_path
(
@project
,
@merge_request
,
merge_request_diff
,
@start_sha
),
class:
(
'is-active'
if
merge_request_diff
==
@merge_request_diff
)
do
%strong
%strong
-
if
merge_request_diff
.
latest?
-
if
merge_request_diff
.
latest?
latest version
latest version
...
...
spec/features/merge_requests/merge_request_versions_spec.rb
View file @
139ff578
...
@@ -81,4 +81,52 @@ feature 'Merge Request versions', js: true, feature: true do
...
@@ -81,4 +81,52 @@ feature 'Merge Request versions', js: true, feature: true do
expect
(
page
).
to
have_content
'8 changed files'
expect
(
page
).
to
have_content
'8 changed files'
end
end
end
end
describe
'compare with same version'
do
before
do
page
.
within
'.mr-version-compare-dropdown'
do
find
(
'.btn-default'
).
click
click_link
'version 1'
end
end
it
'should have 0 chages between versions'
do
page
.
within
'.mr-version-compare-dropdown'
do
expect
(
page
).
to
have_content
'version 1'
end
page
.
within
'.mr-version-dropdown'
do
find
(
'.btn-default'
).
click
find
(
:link
,
'version 1'
).
trigger
(
'click'
)
end
expect
(
page
).
to
have_content
'0 changed files'
end
end
describe
'compare with newer version'
do
before
do
page
.
within
'.mr-version-compare-dropdown'
do
find
(
'.btn-default'
).
click
click_link
'version 2'
end
end
it
'should set the compared versions to be the same'
do
page
.
within
'.mr-version-compare-dropdown'
do
expect
(
page
).
to
have_content
'version 2'
end
page
.
within
'.mr-version-dropdown'
do
find
(
'.btn-default'
).
click
find
(
:link
,
'version 1'
).
trigger
(
'click'
)
end
page
.
within
'.mr-version-compare-dropdown'
do
expect
(
page
).
to
have_content
'version 1'
end
expect
(
page
).
to
have_content
'0 changed files'
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