automerge()
click to toggle source
def automerge
return access_denied! unless can?(current_user, :accept_mr, @project)
if @merge_request.open? && @merge_request.can_be_merged?
@merge_request.should_remove_source_branch = params[:should_remove_source_branch]
@merge_request.automerge!(current_user)
@status = true
else
@status = false
end
end
automerge_check()
click to toggle source
def automerge_check
if @merge_request.unchecked?
@merge_request.check_if_can_be_merged
end
render json: {state: @merge_request.human_state}
end
branch_from()
click to toggle source
def branch_from
@commit = project.commit(params[:ref])
@commit = CommitDecorator.decorate(@commit)
end
branch_to()
click to toggle source
def branch_to
@commit = project.commit(params[:ref])
@commit = CommitDecorator.decorate(@commit)
end
create()
click to toggle source
def create
@merge_request = @project.merge_requests.new(params[:merge_request])
@merge_request.author = current_user
if @merge_request.save
@merge_request.reload_code
redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.'
else
render action: "new"
end
end
destroy()
click to toggle source
def destroy
@merge_request.destroy
respond_to do |format|
format.html { redirect_to project_merge_requests_url(@project) }
end
end
diffs()
click to toggle source
def diffs
@diffs = @merge_request.diffs
@commit = @merge_request.last_commit
@comments_allowed = true
@line_notes = @merge_request.notes.where("line_code is not null")
end
edit()
click to toggle source
index()
click to toggle source
def index
@merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute
end
new()
click to toggle source
def new
@merge_request = @project.merge_requests.new(params[:merge_request])
end
raw()
click to toggle source
def raw
send_file @merge_request.to_raw
end
show()
click to toggle source
def show
respond_to do |format|
format.html
format.js
end
end
update()
click to toggle source
def update
if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id))
@merge_request.reload_code
@merge_request.mark_as_unchecked
redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.'
else
render action: "edit"
end
end