Commit 7e5cf83f authored by Felipe Artur's avatar Felipe Artur

Fix conflicts

parent 73c7dc10
......@@ -354,14 +354,11 @@ constraints(ProjectUrlConstrainer.new) do
end
end
end
<<<<<<< HEAD
## EE-specific
resources :audit_events, only: [:index]
## EE-specific
=======
>>>>>>> 9f0d794513... Moved the webhooks and services gear options to a single one called integrations
namespace :settings do
resource :members, only: [:show]
resource :integrations, only: [:show]
......
......@@ -145,7 +145,6 @@ module API
use :optional_params
at_least_one_of :title, :target_branch, :description, :assignee_id,
:milestone_id, :labels, :state_event,
<<<<<<< HEAD
:remove_source_branch, :squash
end
put ':id/merge_requests/:merge_request_id' do
......@@ -188,26 +187,8 @@ module API
if params[:sha] && merge_request.diff_head_sha != params[:sha]
render_api_error!("SHA does not match HEAD of source branch: #{merge_request.diff_head_sha}", 409)
=======
:remove_source_branch
end
put ':id/merge_requests/:merge_request_id' do
merge_request = find_merge_request_with_access(params.delete(:merge_request_id), :update_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)
if merge_request.valid?
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
else
handle_merge_request_errors! merge_request.errors
>>>>>>> ce/master
end
end
<<<<<<< HEAD
if params[:squash]
merge_request.update(squash: params[:squash])
end
......@@ -335,98 +316,6 @@ module API
.execute(merge_request)
present merge_request, with: Entities::MergeRequestApprovals, current_user: current_user
=======
desc 'Merge a merge request' do
success Entities::MergeRequest
end
params do
optional :merge_commit_message, type: String, desc: 'Custom merge commit message'
optional :should_remove_source_branch, type: Boolean,
desc: 'When true, the source branch will be deleted if possible'
optional :merge_when_build_succeeds, type: Boolean,
desc: 'When true, this merge request will be merged when the pipeline succeeds'
optional :sha, type: String, desc: 'When present, must have the HEAD SHA of the source branch'
end
put ':id/merge_requests/:merge_request_id/merge' do
merge_request = find_project_merge_request(params[:merge_request_id])
# Merge request can not be merged
# because user dont have permissions to push into target branch
unauthorized! unless merge_request.can_be_merged_by?(current_user)
not_allowed! unless merge_request.mergeable_state?
render_api_error!('Branch cannot be merged', 406) unless merge_request.mergeable?
if params[:sha] && merge_request.diff_head_sha != params[:sha]
render_api_error!("SHA does not match HEAD of source branch: #{merge_request.diff_head_sha}", 409)
end
merge_params = {
commit_message: params[:merge_commit_message],
should_remove_source_branch: params[:should_remove_source_branch]
}
if params[:merge_when_build_succeeds] && merge_request.head_pipeline && merge_request.head_pipeline.active?
::MergeRequests::MergeWhenPipelineSucceedsService
.new(merge_request.target_project, current_user, merge_params)
.execute(merge_request)
else
::MergeRequests::MergeService
.new(merge_request.target_project, current_user, merge_params)
.execute(merge_request)
end
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Cancel merge if "Merge When Pipeline Succeeds" is enabled' do
success Entities::MergeRequest
end
post ':id/merge_requests/:merge_request_id/cancel_merge_when_build_succeeds' do
merge_request = find_project_merge_request(params[:merge_request_id])
unauthorized! unless merge_request.can_cancel_merge_when_build_succeeds?(current_user)
::MergeRequest::MergeWhenPipelineSucceedsService
.new(merge_request.target_project, current_user)
.cancel(merge_request)
end
desc 'Get the comments of a merge request' do
success Entities::MRNote
end
params do
use :pagination
end
get ':id/merge_requests/:merge_request_id/comments' do
merge_request = find_merge_request_with_access(params[:merge_request_id])
present paginate(merge_request.notes.fresh), with: Entities::MRNote
end
desc 'Post a comment to a merge request' do
success Entities::MRNote
end
params do
requires :note, type: String, desc: 'The text of the comment'
end
post ':id/merge_requests/:merge_request_id/comments' do
merge_request = find_merge_request_with_access(params[:merge_request_id], :create_note)
opts = {
note: params[:note],
noteable_type: 'MergeRequest',
noteable_id: merge_request.id
}
note = ::Notes::CreateService.new(user_project, current_user, opts).execute
if note.save
present note, with: Entities::MRNote
else
render_api_error!("Failed to save note #{note.errors.messages}", 400)
end
>>>>>>> ce/master
end
desc 'List issues that will be closed on merge' do
......
......@@ -50,11 +50,7 @@ module API
resource :issues do
desc "Get currently authenticated user's issues" do
<<<<<<< HEAD
success Entities::Issue
=======
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
optional :state, type: String, values: %w[opened closed all], default: 'all',
......@@ -63,12 +59,7 @@ module API
end
get do
issues = find_issues(scope: 'authored')
<<<<<<< HEAD
present paginate(issues), with: Entities::Issue, current_user: current_user
=======
present paginate(issues), with: ::API::Entities::Issue, current_user: current_user
>>>>>>> ce/master
end
end
......@@ -77,11 +68,7 @@ module API
end
resource :groups do
desc 'Get a list of group issues' do
<<<<<<< HEAD
success Entities::Issue
=======
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
optional :state, type: String, values: %w[opened closed all], default: 'opened',
......@@ -93,11 +80,7 @@ module API
issues = find_issues(group_id: group.id, state: params[:state] || 'opened', match_all_labels: true)
<<<<<<< HEAD
present paginate(issues), with: Entities::Issue, current_user: current_user
=======
present paginate(issues), with: ::API::Entities::Issue, current_user: current_user
>>>>>>> ce/master
end
end
......@@ -109,11 +92,7 @@ module API
desc 'Get a list of project issues' do
detail 'iid filter is deprecated have been removed on V4'
<<<<<<< HEAD
success Entities::Issue
=======
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
optional :state, type: String, values: %w[opened closed all], default: 'all',
......@@ -126,38 +105,22 @@ module API
issues = find_issues(project_id: project.id)
<<<<<<< HEAD
present paginate(issues), with: Entities::Issue, current_user: current_user, project: user_project
end
desc 'Get a single project issue' do
success Entities::Issue
=======
present paginate(issues), with: ::API::Entities::Issue, current_user: current_user, project: user_project
end
desc 'Get a single project issue' do
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
requires :issue_id, type: Integer, desc: 'The ID of a project issue'
end
get ":id/issues/:issue_id" do
issue = find_project_issue(params[:issue_id])
<<<<<<< HEAD
present issue, with: Entities::Issue, current_user: current_user, project: user_project
end
desc 'Create a new project issue' do
success Entities::Issue
=======
present issue, with: ::API::Entities::Issue, current_user: current_user, project: user_project
end
desc 'Create a new project issue' do
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
requires :title, type: String, desc: 'The title of an issue'
......@@ -189,22 +152,14 @@ module API
end
if issue.valid?
<<<<<<< HEAD
present issue, with: Entities::Issue, current_user: current_user, project: user_project
=======
present issue, with: ::API::Entities::Issue, current_user: current_user, project: user_project
>>>>>>> ce/master
else
render_validation_error!(issue)
end
end
desc 'Update an existing issue' do
<<<<<<< HEAD
success Entities::Issue
=======
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
requires :issue_id, type: Integer, desc: 'The ID of a project issue'
......@@ -230,22 +185,14 @@ module API
declared_params(include_missing: false)).execute(issue)
if issue.valid?
<<<<<<< HEAD
present issue, with: Entities::Issue, current_user: current_user, project: user_project
=======
present issue, with: ::API::Entities::Issue, current_user: current_user, project: user_project
>>>>>>> ce/master
else
render_validation_error!(issue)
end
end
desc 'Move an existing issue' do
<<<<<<< HEAD
success Entities::Issue
=======
success ::API::Entities::Issue
>>>>>>> ce/master
end
params do
requires :issue_id, type: Integer, desc: 'The ID of a project issue'
......@@ -260,11 +207,7 @@ module API
begin
issue = ::Issues::MoveService.new(user_project, current_user).execute(issue, new_project)
<<<<<<< HEAD
present issue, with: Entities::Issue, current_user: current_user, project: user_project
=======
present issue, with: ::API::Entities::Issue, current_user: current_user, project: user_project
>>>>>>> ce/master
rescue ::Issues::MoveService::MoveError => error
render_api_error!(error.message, 400)
end
......
......@@ -33,23 +33,15 @@ 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'
<<<<<<< HEAD
optional :approvals_before_merge, type: Integer, desc: 'Number of approvals required before this can be merged'
optional :remove_source_branch, type: Boolean, desc: 'Remove source branch when merging'
optional :squash, type: Boolean, desc: 'Squash commits when merging'
=======
optional :remove_source_branch, type: Boolean, desc: 'Remove source branch when merging'
>>>>>>> ce/master
end
end
desc 'List merge requests' do
<<<<<<< HEAD
success Entities::MergeRequest
=======
detail 'iid filter is deprecated have been removed on V4'
success ::API::Entities::MergeRequest
>>>>>>> ce/master
end
params do
optional :state, type: String, values: %w[opened closed merged all], default: 'all',
......@@ -76,19 +68,12 @@ module API
end
merge_requests = merge_requests.reorder(params[:order_by] => params[:sort])
<<<<<<< HEAD
present paginate(merge_requests), with: Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Create a merge request' do
success Entities::MergeRequest
=======
present paginate(merge_requests), with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Create a merge request' do
success ::API::Entities::MergeRequest
>>>>>>> ce/master
end
params do
requires :title, type: String, desc: 'The title of the merge request'
......@@ -107,11 +92,7 @@ module API
merge_request = ::MergeRequests::CreateService.new(user_project, current_user, mr_params).execute
if merge_request.valid?
<<<<<<< HEAD
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
=======
present merge_request, with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project
>>>>>>> ce/master
else
handle_merge_request_errors! merge_request.errors
end
......@@ -128,12 +109,6 @@ module API
merge_request.destroy
end
<<<<<<< HEAD
# Routing "merge_request/:merge_request_id/..." is DEPRECATED and WILL BE REMOVED in version 9.0
# Use "merge_requests/:merge_request_id/..." instead.
#
=======
>>>>>>> ce/master
params do
requires :merge_request_id, type: Integer, desc: 'The ID of a merge request'
end
......@@ -142,62 +117,34 @@ module API
if status == :deprecated
detail DEPRECATION_MESSAGE
end
<<<<<<< HEAD
success Entities::MergeRequest
=======
success ::API::Entities::MergeRequest
>>>>>>> ce/master
end
get path do
merge_request = find_merge_request_with_access(params[:merge_request_id])
<<<<<<< HEAD
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Get the commits of a merge request' do
success Entities::RepoCommit
=======
present merge_request, with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Get the commits of a merge request' do
success ::API::Entities::RepoCommit
>>>>>>> ce/master
end
get "#{path}/commits" do
merge_request = find_merge_request_with_access(params[:merge_request_id])
<<<<<<< HEAD
present merge_request.commits, with: Entities::RepoCommit
end
desc 'Show the merge request changes' do
success Entities::MergeRequestChanges
=======
present merge_request.commits, with: ::API::Entities::RepoCommit
end
desc 'Show the merge request changes' do
success ::API::Entities::MergeRequestChanges
>>>>>>> ce/master
end
get "#{path}/changes" do
merge_request = find_merge_request_with_access(params[:merge_request_id])
<<<<<<< HEAD
present merge_request, with: Entities::MergeRequestChanges, current_user: current_user
end
desc 'Update a merge request' do
success Entities::MergeRequest
=======
present merge_request, with: ::API::Entities::MergeRequestChanges, current_user: current_user
end
desc 'Update a merge request' do
success ::API::Entities::MergeRequest
>>>>>>> ce/master
end
params do
optional :title, type: String, allow_blank: false, desc: 'The title of the merge request'
......@@ -206,13 +153,8 @@ module API
desc: 'Status of the merge request'
use :optional_params
at_least_one_of :title, :target_branch, :description, :assignee_id,
<<<<<<< HEAD
:milestone_id, :labels, :state_event, :approvals_before_merge,
:remove_source_branch, :squash
=======
:milestone_id, :labels, :state_event,
:remove_source_branch
>>>>>>> ce/master
end
put path do
merge_request = find_merge_request_with_access(params.delete(:merge_request_id), :update_merge_request)
......@@ -223,22 +165,14 @@ module API
merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, mr_params).execute(merge_request)
if merge_request.valid?
<<<<<<< HEAD
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
=======
present merge_request, with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project
>>>>>>> ce/master
else
handle_merge_request_errors! merge_request.errors
end
end
desc 'Merge a merge request' do
<<<<<<< HEAD
success Entities::MergeRequest
=======
success ::API::Entities::MergeRequest
>>>>>>> ce/master
end
params do
optional :merge_commit_message, type: String, desc: 'Custom merge commit message'
......@@ -247,10 +181,7 @@ module API
optional :merge_when_build_succeeds, type: Boolean,
desc: 'When true, this merge request will be merged when the pipeline succeeds'
optional :sha, type: String, desc: 'When present, must have the HEAD SHA of the source branch'
<<<<<<< HEAD
optional :squash, type: Boolean, desc: 'When true, the commits will be squashed into a single commit on merge'
=======
>>>>>>> ce/master
end
put "#{path}/merge" do
merge_request = find_project_merge_request(params[:merge_request_id])
......@@ -267,13 +198,10 @@ module API
render_api_error!("SHA does not match HEAD of source branch: #{merge_request.diff_head_sha}", 409)
end
<<<<<<< HEAD
if params[:squash]
merge_request.update(squash: params[:squash])
end
=======
>>>>>>> ce/master
merge_params = {
commit_message: params[:merge_commit_message],
should_remove_source_branch: params[:should_remove_source_branch]
......@@ -289,19 +217,11 @@ module API
.execute(merge_request)
end
<<<<<<< HEAD
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Cancel merge if "Merge When Pipeline Succeeds" is enabled' do
success Entities::MergeRequest
=======
present merge_request, with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project
end
desc 'Cancel merge if "Merge When Pipeline Succeeds" is enabled' do
success ::API::Entities::MergeRequest
>>>>>>> ce/master
end
post "#{path}/cancel_merge_when_build_succeeds" do
merge_request = find_project_merge_request(params[:merge_request_id])
......@@ -314,34 +234,20 @@ module API
end
desc 'Get the comments of a merge request' do
<<<<<<< HEAD
detail 'Duplicate. DEPRECATED and WILL BE REMOVED in 9.0'
success Entities::MRNote
=======
detail 'Duplicate. DEPRECATED and HAS BEEN REMOVED in V4'
success ::API::Entities::MRNote
>>>>>>> ce/master
end
params do
use :pagination
end
get "#{path}/comments" do
merge_request = find_merge_request_with_access(params[:merge_request_id])
<<<<<<< HEAD
present paginate(merge_request.notes.fresh), with: Entities::MRNote
end
desc 'Post a comment to a merge request' do
detail 'Duplicate. DEPRECATED and WILL BE REMOVED in 9.0'
success Entities::MRNote
=======
present paginate(merge_request.notes.fresh), with: ::API::Entities::MRNote
end
desc 'Post a comment to a merge request' do
detail 'Duplicate. DEPRECATED and HAS BEEN REMOVED in V4'
success ::API::Entities::MRNote
>>>>>>> ce/master
end
params do
requires :note, type: String, desc: 'The text of the comment'
......@@ -358,22 +264,14 @@ module API
note = ::Notes::CreateService.new(user_project, current_user, opts).execute
if note.save
<<<<<<< HEAD
present note, with: Entities::MRNote
=======
present note, with: ::API::Entities::MRNote
>>>>>>> ce/master
else
render_api_error!("Failed to save note #{note.errors.messages}", 400)
end
end
desc 'List issues that will be closed on merge' do
<<<<<<< HEAD
success Entities::MRNote
=======
success ::API::Entities::MRNote
>>>>>>> ce/master
end
params do
use :pagination
......@@ -383,7 +281,6 @@ module API
issues = ::Kaminari.paginate_array(merge_request.closes_issues(current_user))
present paginate(issues), with: issue_entity(user_project), current_user: current_user
end
<<<<<<< HEAD
# Get the status of the merge request's approvals
#
......@@ -431,8 +328,6 @@ module API
present merge_request, with: Entities::MergeRequestApprovals, current_user: current_user
end
=======
>>>>>>> ce/master
end
end
end
......
......@@ -163,15 +163,6 @@ namespace :gitlab do
namespace :pages do
task create: :environment do
<<<<<<< HEAD
$progress.puts "Dumping pages ... ".color(:blue)
if ENV["SKIP"] && ENV["SKIP"].include?("pages")
$progress.puts "[SKIPPED]".color(:cyan)
else
Backup::Pages.new.dump
$progress.puts "done".color(:green)
=======
$progress.puts "Dumping pages ... ".blue
if ENV["SKIP"] && ENV["SKIP"].include?("pages")
......@@ -179,20 +170,13 @@ namespace :gitlab do
else
Backup::Pages.new.dump
$progress.puts "done".green
>>>>>>> ce/master
end
end
task restore: :environment do
<<<<<<< HEAD
$progress.puts "Restoring pages ... ".color(:blue)
Backup::Pages.new.restore
$progress.puts "done".color(:green)
=======
$progress.puts "Restoring pages ... ".blue
Backup::Pages.new.restore
$progress.puts "done".green
>>>>>>> ce/master
end
end
......
......@@ -1238,7 +1238,6 @@ describe Project, models: true do
end
end
<<<<<<< HEAD
describe '#pages_url' do
let(:group) { create :group, name: group_name }
let(:project) { create :empty_project, namespace: group, name: project_name }
......@@ -1266,8 +1265,6 @@ describe Project, models: true do
end
end
=======
>>>>>>> ce/master
describe '.search' do
let(:project) { create(:empty_project, description: 'kitten mittens') }
......
require "spec_helper"
<<<<<<< HEAD
describe API::MergeRequests, v3_api: true do
=======
describe API::MergeRequests, api: true do
>>>>>>> ce/master
include ApiHelpers
let(:base_time) { Time.now }
let(:user) { create(:user) }
......@@ -43,10 +39,7 @@ describe API::MergeRequests, api: true do
expect(json_response.first['sha']).to eq(merge_request_merged.diff_head_sha)
expect(json_response.first['merge_commit_sha']).not_to be_nil
expect(json_response.first['merge_commit_sha']).to eq(merge_request_merged.merge_commit_sha)
<<<<<<< HEAD
expect(json_response.first['squash']).to eq(merge_request_merged.squash)
=======
>>>>>>> ce/master
end
it "returns an array of all merge_requests" do
......@@ -241,22 +234,15 @@ describe API::MergeRequests, api: true do
author: user,
labels: 'label, label2',
milestone_id: milestone.id,
<<<<<<< HEAD
remove_source_branch: true,
squash: true
=======
remove_source_branch: true
>>>>>>> ce/master
expect(response).to have_http_status(201)
expect(json_response['title']).to eq('Test merge_request')
expect(json_response['labels']).to eq(['label', 'label2'])
expect(json_response['milestone']['id']).to eq(milestone.id)
expect(json_response['force_remove_source_branch']).to be_truthy
<<<<<<< HEAD
expect(json_response['squash']).to be_truthy
=======
>>>>>>> ce/master
end
it "returns 422 when source_branch equals target_branch" do
......@@ -395,7 +381,6 @@ describe API::MergeRequests, api: true do
expect(response).to have_http_status(201)
end
end
<<<<<<< HEAD
context 'the approvals_before_merge param' do
def create_merge_request(approvals_before_merge)
......@@ -456,8 +441,6 @@ describe API::MergeRequests, api: true do
end
end
end
=======
>>>>>>> ce/master
end
describe "DELETE /projects/:id/merge_requests/:merge_request_id" do
......@@ -546,7 +529,6 @@ describe API::MergeRequests, api: true do
expect(response).to have_http_status(200)
end
<<<<<<< HEAD
it "updates the MR's squash attribute" do
expect do
put v3_api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user), squash: true
......@@ -555,8 +537,6 @@ describe API::MergeRequests, api: true do
expect(response).to have_http_status(200)
end
=======
>>>>>>> ce/master
it "enables merge when pipeline succeeds if the pipeline is active" do
allow_any_instance_of(MergeRequest).to receive(:head_pipeline).and_return(pipeline)
allow(pipeline).to receive(:active?).and_return(true)
......@@ -597,7 +577,6 @@ describe API::MergeRequests, api: true do
expect(json_response['milestone']['id']).to eq(milestone.id)
end
<<<<<<< HEAD
it "updates squash and returns merge_request" do
put v3_api("/projects/#{project.id}/merge_requests/#{merge_request.id}", user), squash: true
......@@ -605,8 +584,6 @@ describe API::MergeRequests, api: true do
expect(json_response['squash']).to be_truthy
end
=======
>>>>>>> ce/master
it "returns merge_request with renamed target_branch" do
put v3_api("/projects/#{project.id}/merge_requests/#{merge_request.id}", user), target_branch: "wiki"
expect(response).to have_http_status(200)
......@@ -803,7 +780,6 @@ describe API::MergeRequests, api: true do
end
end
<<<<<<< HEAD
describe 'GET :id/merge_requests/:merge_request_id/approvals' do
it 'retrieves the approval status' do
approver = create :user
......@@ -882,8 +858,6 @@ describe API::MergeRequests, api: true do
end
end
=======
>>>>>>> ce/master
describe 'Time tracking' do
let(:issuable) { merge_request }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment