Commit 91d73233 authored by Igor Drozdov's avatar Igor Drozdov Committed by Sean McGivern

Remove diff_compare_with_head feature flag

Always display minimal merge-ref-diff option
which does not include commenting support
but will allow users to compare against master (HEAD) and master (base)
parent 1e527d1e
...@@ -40,10 +40,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => { ...@@ -40,10 +40,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
}; };
}; };
if (gon.features?.diffCompareWithHead) { return [...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion, headVersion];
return [...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion, headVersion];
}
return [...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion];
}; };
export const diffCompareDropdownSourceVersions = (state, getters) => { export const diffCompareDropdownSourceVersions = (state, getters) => {
......
...@@ -26,7 +26,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -26,7 +26,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:code_navigation, @project) push_frontend_feature_flag(:code_navigation, @project)
push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true) push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true)
push_frontend_feature_flag(:merge_ref_head_comments, @project) push_frontend_feature_flag(:merge_ref_head_comments, @project)
push_frontend_feature_flag(:diff_compare_with_head, @project)
push_frontend_feature_flag(:accessibility_merge_request_widget, @project) push_frontend_feature_flag(:accessibility_merge_request_widget, @project)
end end
......
...@@ -875,7 +875,7 @@ class MergeRequest < ApplicationRecord ...@@ -875,7 +875,7 @@ class MergeRequest < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass # rubocop: enable CodeReuse/ServiceClass
def diffable_merge_ref? def diffable_merge_ref?
Feature.enabled?(:diff_compare_with_head, target_project) && can_be_merged? && merge_ref_head.present? can_be_merged? && merge_ref_head.present?
end end
# Returns boolean indicating the merge_status should be rechecked in order to # Returns boolean indicating the merge_status should be rechecked in order to
......
---
title: Allow showing merge request diffs compared to current version of target branch
merge_request: 31325
author:
type: added
...@@ -57,7 +57,7 @@ source and target branch can be shown mixed together making it hard to ...@@ -57,7 +57,7 @@ source and target branch can be shown mixed together making it hard to
understand which changes are being added and which already exist in the understand which changes are being added and which already exist in the
target branch. target branch.
In GitLab 12.10, we added an **experimental** comparison mode, which In GitLab 12.10, we added a comparison mode, which
shows a diff calculated by simulating how it would look like once merged - a more accurate shows a diff calculated by simulating how it would look like once merged - a more accurate
representation of the changes rather than using the base of the two representation of the changes rather than using the base of the two
branches. The new mode is available from the comparison target drop down branches. The new mode is available from the comparison target drop down
...@@ -67,26 +67,6 @@ current default comparison. ...@@ -67,26 +67,6 @@ current default comparison.
![Merge request versions compare HEAD](img/versions_compare_head_v12_10.png) ![Merge request versions compare HEAD](img/versions_compare_head_v12_10.png)
### Enable or disable `HEAD` comparison mode **(CORE ONLY)**
`HEAD` comparison mode is under development and not ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/troubleshooting/navigating_gitlab_via_rails_console.md#starting-a-rails-console-session)
can enable it for your instance. You're welcome to test it, but use it at your
own risk.
To enable it:
```ruby
Feature.enable(:diff_compare_with_head)
```
To disable it:
```ruby
Feature.disable(:diff_compare_with_head)
```
<!-- ## Troubleshooting <!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
...@@ -18,7 +18,6 @@ describe('Compare diff version dropdowns', () => { ...@@ -18,7 +18,6 @@ describe('Compare diff version dropdowns', () => {
}; };
localState.targetBranchName = 'baseVersion'; localState.targetBranchName = 'baseVersion';
localState.mergeRequestDiffs = diffsMockData; localState.mergeRequestDiffs = diffsMockData;
gon.features = { diffCompareWithHead: true };
}); });
describe('selectedTargetIndex', () => { describe('selectedTargetIndex', () => {
...@@ -129,14 +128,6 @@ describe('Compare diff version dropdowns', () => { ...@@ -129,14 +128,6 @@ describe('Compare diff version dropdowns', () => {
}); });
assertVersions(targetVersions); assertVersions(targetVersions);
}); });
it('does not list head version if feature flag is not enabled', () => {
gon.features = { diffCompareWithHead: false };
setupTest();
const targetVersions = getters.diffCompareDropdownTargetVersions(localState, getters);
expect(targetVersions.find(version => version.isHead)).toBeUndefined();
});
}); });
it('diffCompareDropdownSourceVersions', () => { it('diffCompareDropdownSourceVersions', () => {
......
...@@ -3836,40 +3836,28 @@ describe MergeRequest do ...@@ -3836,40 +3836,28 @@ describe MergeRequest do
end end
describe '#diffable_merge_ref?' do describe '#diffable_merge_ref?' do
context 'diff_compare_with_head enabled' do context 'merge request can be merged' do
context 'merge request can be merged' do context 'merge_to_ref is not calculated' do
context 'merge_to_ref is not calculated' do it 'returns true' do
it 'returns true' do expect(subject.diffable_merge_ref?).to eq(false)
expect(subject.diffable_merge_ref?).to eq(false)
end
end
context 'merge_to_ref is calculated' do
before do
MergeRequests::MergeToRefService.new(subject.project, subject.author).execute(subject)
end
it 'returns true' do
expect(subject.diffable_merge_ref?).to eq(true)
end
end end
end end
context 'merge request cannot be merged' do context 'merge_to_ref is calculated' do
it 'returns false' do before do
subject.mark_as_unchecked! MergeRequests::MergeToRefService.new(subject.project, subject.author).execute(subject)
end
expect(subject.diffable_merge_ref?).to eq(false) it 'returns true' do
expect(subject.diffable_merge_ref?).to eq(true)
end end
end end
end end
context 'diff_compare_with_head disabled' do context 'merge request cannot be merged' do
before do
stub_feature_flags(diff_compare_with_head: { enabled: false, thing: subject.target_project })
end
it 'returns false' do it 'returns false' do
subject.mark_as_unchecked!
expect(subject.diffable_merge_ref?).to eq(false) expect(subject.diffable_merge_ref?).to eq(false)
end end
end end
......
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