diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-02-02 20:51:37 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-02-19 13:14:50 -0500 |
commit | b6fe51b901ebba9892718df53b5c0b4515b8d758 (patch) | |
tree | c4876b8249d7f7a76a2b2ec31e3513a6acedecc2 /app/controllers | |
parent | 1708e1fc03439adec8e4f3aa341faaf6f378f192 (diff) | |
download | gitlab-ce-b6fe51b901ebba9892718df53b5c0b4515b8d758.tar.gz |
Some updates from last code review.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 0fcb3063f29..e9d07614785 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -193,18 +193,18 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def revert - 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, - source_project_id: @merge_request.target_project_id, - target_project_id: @merge_request.target_project_id, - description: @merge_request.revert_description - }} - - if target_branch_exists + url_params = { + merge_request: { source_branch: @merge_request.revert_branch_name, + target_branch: @merge_request.target_branch, + source_project_id: @merge_request.target_project_id, + target_project_id: @merge_request.target_project_id, + description: @merge_request.revert_description } + } + + if @merge_request.target_branch_exists? && @merge_request.merge_commit_sha.present? @repository.revert_merge(current_user, @merge_request.merge_commit_sha, - @merge_request.revert_branch_name, @merge_request.revert_title) + @merge_request.revert_branch_name, @merge_request.target_branch, + @merge_request.revert_title) redirect_to new_namespace_project_merge_request_url(@project.namespace, @project, url_params) else |