diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-09 16:39:53 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-09 16:39:53 +0300 |
commit | 192d40e53e3a3bdd397b15f50d6ad1b9840c67b3 (patch) | |
tree | 21f28578ddca005b91bba27bbf9c30fce5327f05 /lib | |
parent | b026e8cd88a3345c8c8fdb25bb12465d520939f6 (diff) | |
parent | 8b5c16e4b1d54745ba6ca65ecfbf14c1683db3b4 (diff) |
Merge branch 'api-remove-source-branch' into 'master'
API: Ability to remove source branch
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23577
See merge request !7804
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/merge_requests.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 253460830ff..55bdbc6a47c 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -30,6 +30,7 @@ module API optional :assignee_id, type: Integer, desc: 'The ID of a user to assign the merge request' optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign the merge request' optional :labels, type: String, desc: 'Comma-separated list of label names' + optional :remove_source_branch, type: Boolean, desc: 'Remove source branch when merging' end end @@ -78,7 +79,8 @@ module API post ":id/merge_requests" do authorize! :create_merge_request, user_project - mr_params = declared_params + mr_params = declared_params(include_missing: false) + mr_params[:force_remove_source_branch] = mr_params.delete(:remove_source_branch) if mr_params[:remove_source_branch].present? merge_request = ::MergeRequests::CreateService.new(user_project, current_user, mr_params).execute @@ -147,13 +149,15 @@ module API desc: 'Status of the merge request' use :optional_params at_least_one_of :title, :target_branch, :description, :assignee_id, - :milestone_id, :labels, :state_event + :milestone_id, :labels, :state_event, + :remove_source_branch end put path do merge_request = user_project.merge_requests.find(params.delete(:merge_request_id)) authorize! :update_merge_request, merge_request mr_params = declared_params(include_missing: false) + mr_params[:force_remove_source_branch] = mr_params.delete(:remove_source_branch) if mr_params[:remove_source_branch].present? merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, mr_params).execute(merge_request) |