Commit f1c356b7 authored by Alessio Caiazza's avatar Alessio Caiazza

Merge branch 'ac-remove-track_mr_picking-ff' into 'master'

Remove track mr picking ff

See merge request gitlab-org/gitlab!26907
parents e035a2e9 341a7c53
...@@ -11,8 +11,6 @@ module Commits ...@@ -11,8 +11,6 @@ module Commits
private private
def track_mr_picking(pick_sha) def track_mr_picking(pick_sha)
return unless Feature.enabled?(:track_mr_picking, project)
merge_request = project.merge_requests.by_merge_commit_sha(@commit.sha).first merge_request = project.merge_requests.by_merge_commit_sha(@commit.sha).first
return unless merge_request return unless merge_request
......
...@@ -38,8 +38,6 @@ module Deployments ...@@ -38,8 +38,6 @@ module Deployments
.commits_between(from, to) .commits_between(from, to)
.map(&:id) .map(&:id)
track_mr_picking = Feature.enabled?(:track_mr_picking, project)
# For some projects the list of commits to deploy may be very large. To # For some projects the list of commits to deploy may be very large. To
# ensure we do not end up running SQL queries with thousands of WHERE IN # ensure we do not end up running SQL queries with thousands of WHERE IN
# values, we run one query per a certain number of commits. # values, we run one query per a certain number of commits.
...@@ -53,8 +51,6 @@ module Deployments ...@@ -53,8 +51,6 @@ module Deployments
deployment.link_merge_requests(merge_requests) deployment.link_merge_requests(merge_requests)
next unless track_mr_picking
picked_merge_requests = picked_merge_requests =
project.merge_requests.by_cherry_pick_sha(slice) project.merge_requests.by_cherry_pick_sha(slice)
......
...@@ -143,7 +143,7 @@ module SystemNotes ...@@ -143,7 +143,7 @@ module SystemNotes
def picked_into_branch(branch_name, pick_commit) def picked_into_branch(branch_name, pick_commit)
link = url_helpers.project_tree_path(project, branch_name) link = url_helpers.project_tree_path(project, branch_name)
body = "picked this merge request into branch [`#{branch_name}`](#{link}) with commit #{pick_commit}" body = "picked the changes into the branch [`#{branch_name}`](#{link}) with commit #{pick_commit}"
summary = NoteSummary.new(noteable, project, author, body, action: 'cherry_pick') summary = NoteSummary.new(noteable, project, author, body, action: 'cherry_pick')
summary.note[:commit_id] = pick_commit summary.note[:commit_id] = pick_commit
......
---
title: Track merge request cherry-picks
merge_request: 26907
author:
type: added
...@@ -21,6 +21,20 @@ where you can choose to either: ...@@ -21,6 +21,20 @@ where you can choose to either:
- Cherry-pick the changes directly into the selected branch. - Cherry-pick the changes directly into the selected branch.
- Create a new merge request with the cherry-picked changes. - Create a new merge request with the cherry-picked changes.
### Cherry-pick tracking
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2675) in GitLab 12.9.
When you cherry-pick a merge commit, GitLab will output a system note to the related merge
request thread crosslinking the new commit and the existing merge request.
![Cherry-pick tracking in Merge Request timeline](img/cherry_pick_mr_timeline_v12_9.png)
Each deployment's [list of associated merge requests](../../../api/deployments.md#list-of-merge-requests-associated-with-a-deployment) will include cherry-picked merge commits.
NOTE: **Note:**
We only track cherry-pick executed from GitLab (both UI and API). Support for [tracking cherry-picked commits through the command line](https://gitlab.com/gitlab-org/gitlab/issues/202215) is planned for a future release.
## Cherry-picking a commit ## Cherry-picking a commit
You can cherry-pick a commit from the commit details page: You can cherry-pick a commit from the commit details page:
......
...@@ -61,18 +61,6 @@ describe Commits::CherryPickService do ...@@ -61,18 +61,6 @@ describe Commits::CherryPickService do
expect(mr_notes.length).to eq(1) expect(mr_notes.length).to eq(1)
expect(mr_notes[0].commit_id).to eq(result[:result]) expect(mr_notes[0].commit_id).to eq(result[:result])
end end
context 'when :track_mr_picking feature flag is disabled' do
before do
stub_feature_flags(track_mr_picking: false)
end
it 'does not add system notes' do
expect do
cherry_pick(merge_commit_sha, branch_name)
end.not_to change { Note.count }
end
end
end end
def find_cherry_pick_notes(noteable) def find_cherry_pick_notes(noteable)
......
...@@ -160,53 +160,6 @@ describe Deployments::LinkMergeRequestsService do ...@@ -160,53 +160,6 @@ describe Deployments::LinkMergeRequestsService do
expect(deploy.merge_requests).to be_empty expect(deploy.merge_requests).to be_empty
end end
context 'when :track_mr_picking feature flag is disabled' do
before do
stub_feature_flags(track_mr_picking: false)
end
it 'does not link picked merge requests' do
environment = create(:environment, project: project)
deploy =
create(:deployment, :success, project: project, environment: environment)
picked_mr = create(
:merge_request,
:merged,
merge_commit_sha: '123abc',
source_project: project,
target_project: project
)
mr1 = create(
:merge_request,
:merged,
merge_commit_sha: mr1_merge_commit_sha,
source_project: project,
target_project: project
)
# mr1 includes c1c67abba which is a cherry-pick of the fake picked_mr merge request
create(:track_mr_picking_note, noteable: picked_mr, project: project, commit_id: 'c1c67abbaf91f624347bb3ae96eabe3a1b742478')
mr2 = create(
:merge_request,
:merged,
merge_commit_sha: mr2_merge_commit_sha,
source_project: project,
target_project: project
)
described_class.new(deploy).link_merge_requests_for_range(
first_deployment_sha,
mr2_merge_commit_sha
)
expect(deploy.merge_requests).to include(mr1, mr2)
expect(deploy.merge_requests).not_to include(picked_mr)
end
end
end end
describe '#link_all_merged_merge_requests' do describe '#link_all_merged_merge_requests' do
......
...@@ -253,7 +253,7 @@ describe ::SystemNotes::MergeRequestsService do ...@@ -253,7 +253,7 @@ describe ::SystemNotes::MergeRequestsService do
end end
it "posts the 'picked merge request' system note" do it "posts the 'picked merge request' system note" do
expect(subject.note).to eq("picked this merge request into branch [`#{branch_name}`](/#{project.full_path}/-/tree/#{branch_name}) with commit #{commit_sha}") expect(subject.note).to eq("picked the changes into the branch [`#{branch_name}`](/#{project.full_path}/-/tree/#{branch_name}) with commit #{commit_sha}")
end end
it 'links the merge request and the cherry-pick commit' do it 'links the merge request and the cherry-pick commit' do
......
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