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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
99e00856
Commit
99e00856
authored
Aug 01, 2016
by
Sean McGivern
Committed by
Fatih Acet
Aug 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REMOVE THIS COMMIT: allow undoing last resolution
parent
f0bbfe7a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+12
-1
config/routes.rb
config/routes.rb
+1
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+13
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
99e00856
...
...
@@ -10,7 +10,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:module_enabled
before_action
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:conflicts
,
:builds
,
:merge
,
:merge_check
,
:ci_status
,
:toggle_subscription
,
:cancel_merge_when_build_succeeds
,
:remove_wip
,
:resolve_conflicts
:ci_status
,
:toggle_subscription
,
:cancel_merge_when_build_succeeds
,
:remove_wip
,
:resolve_conflicts
,
:undo_last_resolution
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:define_show_vars
,
only:
[
:show
,
:diffs
,
:commits
,
:conflicts
,
:builds
]
...
...
@@ -160,6 +161,16 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
undo_last_resolution
rugged
=
@merge_request
.
project
.
repository
.
rugged
ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
@merge_request
.
source_branch
prev
=
rugged
.
ref
(
ref
).
target
rugged
.
references
.
update
(
ref
,
prev
.
parents
.
first
.
oid
)
if
prev
.
parents
.
length
==
2
head
:ok
end
def
builds
respond_to
do
|
format
|
format
.
html
do
...
...
config/routes.rb
View file @
99e00856
...
...
@@ -729,6 +729,7 @@ Rails.application.routes.draw do
post
:remove_wip
get
:diff_for_path
post
:resolve_conflicts
post
:undo_last_resolution
end
collection
do
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
99e00856
...
...
@@ -638,6 +638,19 @@ describe Projects::MergeRequestsController do
it
'redirects to the MR show page'
do
expect
(
response
).
to
redirect_to
([
merge_request_with_conflicts
.
target_project
.
namespace
.
becomes
(
Namespace
),
merge_request_with_conflicts
.
target_project
,
merge_request_with_conflicts
])
end
context
'undoing the resolution'
do
before
do
post
:undo_last_resolution
,
namespace_id:
merge_request_with_conflicts
.
project
.
namespace
.
to_param
,
project_id:
merge_request_with_conflicts
.
project
.
to_param
,
id:
merge_request_with_conflicts
.
iid
end
it
'undoes the commit'
do
expect
(
original_head_sha
).
to
eq
(
merge_request_with_conflicts
.
source_branch_head
.
sha
)
end
end
end
context
'when sections are missing'
do
...
...
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