2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
module Commits
|
|
|
|
class CherryPickService < ChangeService
|
2017-08-17 22:00:37 +05:30
|
|
|
def create_commit!
|
2020-03-09 13:42:32 +05:30
|
|
|
commit_change(:cherry_pick).tap do |sha|
|
|
|
|
track_mr_picking(sha)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def track_mr_picking(pick_sha)
|
|
|
|
merge_request = project.merge_requests.by_merge_commit_sha(@commit.sha).first
|
|
|
|
return unless merge_request
|
|
|
|
|
|
|
|
::SystemNotes::MergeRequestsService.new(
|
|
|
|
noteable: merge_request,
|
|
|
|
project: project,
|
|
|
|
author: current_user
|
|
|
|
).picked_into_branch(@branch_name, pick_sha)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|