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
Léo-Paul Géneau
gitlab-ce
Commits
ae46d6ea
Commit
ae46d6ea
authored
Feb 01, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain why MR can't be reverted.
parent
5bb5019e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+8
-8
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
ae46d6ea
...
...
@@ -10,7 +10,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:define_show_vars
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:define_widget_vars
,
only:
[
:merge
,
:cancel_merge_when_build_succeeds
,
:merge_check
]
before_action
:ensure_ref_fetched
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:check_target_branch_exists
,
only:
[
:revert
]
# Allow read any merge_request
before_action
:authorize_read_merge_request!
...
...
@@ -194,8 +193,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def
revert
@repository
.
revert_merge
(
current_user
,
@merge_request
)
target_branch_exists
=
@merge_request
.
target_branch_exists?
url_params
=
{
merge_request:
{
source_branch:
@merge_request
.
revert_branch_name
,
target_branch:
@merge_request
.
target_branch
,
...
...
@@ -204,7 +202,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
description:
"Reverts
#{
@merge_request
.
to_reference
}
"
}}
if
target_branch_exists
@repository
.
revert_merge
(
current_user
,
@merge_request
)
redirect_to
new_namespace_project_merge_request_url
(
@project
.
namespace
,
@project
,
url_params
)
else
redirect_to
namespace_project_merge_request_url
(
@project
.
namespace
,
@project
,
@merge_request
),
alert:
'Merge Request cannot be reverted because target branch was deleted.'
end
end
def
branch_from
...
...
@@ -279,10 +283,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return
render_404
unless
@project
.
merge_requests_enabled
end
def
check_target_branch_exists
return
render_404
unless
@merge_request
.
target_branch_exists?
end
def
validates_merge_request
# If source project was removed (Ex. mr from fork to origin)
return
invalid_mr
unless
@merge_request
.
source_project
...
...
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