Commit 41cd27f2 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents ed55ce1d 095e2843
......@@ -52,7 +52,7 @@ terminal.
# Run at 7:00pm every day:
0 19 * * *
# Run every minute on the 10th of June:
# Run every minute on the 3rd of June:
* * 3 6 *
# Run at 06:30 every Friday:
......
......@@ -26,3 +26,62 @@ To seamlessly navigate among commits in a merge request:
- Using the <kbd>X</kbd> and <kbd>C</kbd> keyboard shortcuts.
![Merge requests commit navigation](img/commit_nav_v13_11.png)
## View merge request commits in context
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29274) in GitLab 13.12.
> - [Deployed behind a feature flag](../../feature_flags.md), enabled by default.
> - Disabled on GitLab.com.
> - Not recommended for production use.
> - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-viewing-merge-request-commits-in-context). **(FREE SELF)**
WARNING:
This feature is in [beta](https://about.gitlab.com/handbook/product/gitlab-the-product/#beta)
and is [incomplete](https://gitlab.com/groups/gitlab-org/-/epics/1192).
Previously merged commits can be added, but they can't be removed due to
[this bug](https://gitlab.com/gitlab-org/gitlab/-/issues/325538).
This in-development feature might not be available for your use. There can be
[risks when enabling features still in development](../../feature_flags.md#risks-when-enabling-features-still-in-development).
Refer to this feature's version history for more details.
When reviewing a merge request, it helps to have more context about the changes
made. That includes unchanged lines in unchanged files, and previous commits
that have already merged that the change is built on.
To add previously merged commits to a merge request for more context:
1. Go to your merge request.
1. Select the **Commits** tab.
1. Scroll to the end of the list of commits, and select **Add previously merged commits**:
![Add previously merged commits button](img/add_previously_merged_commits_button_v14_1.png)
1. Select the commits that you want to add.
1. Select **Save changes**.
To view the changes done on those previously merged commits:
1. On your merge request, select the **Changes** tab.
1. Scroll to **(file-tree)** **Compare** and select **previously merged commits**:
![Previously merged commits](img/previously_merged_commits_v14_1.png)
### Enable or disable viewing merge request commits in context **(FREE SELF)**
Viewing merge request commits in context 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/feature_flags.md)
can enable it.
To enable it:
```ruby
Feature.enable(:context_commits)
```
To disable it:
```ruby
Feature.disable(:context_commits)
```
......@@ -24,10 +24,6 @@ module BulkImports
BulkImports::Pipeline::ExtractedData.new(data: { filepath: filepath })
end
def transform(_, data)
data
end
def load(context, data)
return if data.blank?
......@@ -44,7 +40,7 @@ module BulkImports
end
end
def after_run(context, _)
def after_run(_)
FileUtils.remove_entry(context.extra[:tmpdir]) if context.extra[:tmpdir].present?
end
end
......
......@@ -23,47 +23,55 @@ RSpec.describe BulkImports::Groups::Pipelines::GroupAvatarPipeline do
subject { described_class.new(context) }
describe '#extract' do
it 'downloads the group avatar' do
expect_next_instance_of(
BulkImports::FileDownloadService,
describe '#run' do
it 'updates the group avatar' do
avatar_path = 'spec/fixtures/dk.png'
stub_file_download(
avatar_path,
configuration: context.configuration,
relative_url: "/groups/source%2Ffull%2Fpath/avatar",
dir: an_instance_of(String),
file_size_limit: Avatarable::MAXIMUM_FILE_SIZE,
allowed_content_types: described_class::ALLOWED_AVATAR_DOWNLOAD_TYPES
) do |downloader|
expect(downloader).to receive(:execute)
end
)
subject.run
end
end
expect { subject.run }.to change(context.group, :avatar)
describe '#transform' do
it 'returns the given data' do
expect(subject.transform(nil, :value)).to eq(:value)
expect(context.group.avatar.filename).to eq(File.basename(avatar_path))
end
end
describe '#load' do
it 'updates the group avatar' do
avatar_path = 'spec/fixtures/dk.png'
data = { filepath: fixture_file_upload(avatar_path) }
it 'raises an error when the avatar upload fails' do
avatar_path = 'spec/fixtures/aosp_manifest.xml'
stub_file_download(
avatar_path,
configuration: context.configuration,
relative_url: "/groups/source%2Ffull%2Fpath/avatar",
dir: an_instance_of(String),
file_size_limit: Avatarable::MAXIMUM_FILE_SIZE,
allowed_content_types: described_class::ALLOWED_AVATAR_DOWNLOAD_TYPES
)
expect { subject.load(context, data) }.to change(group, :avatar)
expect_next_instance_of(Gitlab::Import::Logger) do |logger|
expect(logger).to receive(:error)
.with(
bulk_import_id: context.bulk_import.id,
bulk_import_entity_id: context.entity.id,
bulk_import_entity_type: context.entity.source_type,
context_extra: context.extra,
exception_class: "BulkImports::Groups::Pipelines::GroupAvatarPipeline::GroupAvatarLoadingError",
exception_message: "Avatar file format is not supported. Please try one of the following supported formats: image/png, image/jpeg, image/gif, image/bmp, image/tiff, image/vnd.microsoft.icon",
pipeline_class: "BulkImports::Groups::Pipelines::GroupAvatarPipeline",
pipeline_step: :loader
)
end
expect(FileUtils.identical?(avatar_path, group.avatar.file.file)).to eq(true)
expect { subject.run }.to change(BulkImports::Failure, :count)
end
end
it 'raises an error when the avatar upload fails' do
avatar_path = 'spec/fixtures/aosp_manifest.xml'
data = { filepath: fixture_file_upload(avatar_path) }
expect { subject.load(context, data) }.to raise_error(
described_class::GroupAvatarLoadingError,
"Avatar file format is not supported. Please try one of the following supported formats: image/png, image/jpeg, image/gif, image/bmp, image/tiff, image/vnd.microsoft.icon"
)
def stub_file_download(filepath = 'file/path.png', **params)
expect_next_instance_of(BulkImports::FileDownloadService, params.presence) do |downloader|
expect(downloader).to receive(:execute).and_return(filepath)
end
end
end
......@@ -29,7 +29,7 @@ RSpec.describe Gitlab::ImportExport::SnippetRepoRestorer do
expect(restorer.restore).to be_truthy
end.to change { SnippetRepository.count }.by(1)
blob = snippet.repository.blob_at('HEAD', snippet.file_name)
blob = snippet.repository.blob_at(snippet.default_branch, snippet.file_name)
expect(blob).not_to be_nil
expect(blob.data).to eq(snippet.content)
end
......
......@@ -828,14 +828,10 @@ RSpec.describe Snippet do
end
context 'when default branch in settings is different from "master"' do
let(:default_branch) { 'main' }
let(:default_branch) { 'custom-branch' }
it 'changes the HEAD reference to the default branch' do
expect(File.read(head_path).squish).to eq 'ref: refs/heads/master'
subject
expect(File.read(head_path).squish).to eq "ref: refs/heads/#{default_branch}"
expect { subject }.to change { File.read(head_path).squish }.to("ref: refs/heads/#{default_branch}")
end
end
end
......
......@@ -85,8 +85,8 @@ RSpec.describe 'Creating a Snippet' do
end.to change { Snippet.count }.by(1)
snippet = Snippet.last
created_file_1 = snippet.repository.blob_at('HEAD', file_1[:filePath])
created_file_2 = snippet.repository.blob_at('HEAD', file_2[:filePath])
created_file_1 = snippet.repository.blob_at(snippet.default_branch, file_1[:filePath])
created_file_2 = snippet.repository.blob_at(snippet.default_branch, file_2[:filePath])
expect(created_file_1.data).to match(file_1[:content])
expect(created_file_2.data).to match(file_2[:content])
......
......@@ -138,7 +138,7 @@ RSpec.describe API::ProjectSnippets do
aggregate_failures do
expect(snippet.repository.exists?).to be_truthy
blob = snippet.repository.blob_at('master', file_path)
blob = snippet.repository.blob_at(snippet.default_branch, file_path)
expect(blob.data).to eq file_content
end
......
......@@ -223,7 +223,7 @@ RSpec.describe API::Snippets, factory_default: :keep do
it 'commit the files to the repository' do
subject
blob = snippet.repository.blob_at('master', file_path)
blob = snippet.repository.blob_at(snippet.default_branch, file_path)
expect(blob.data).to eq file_content
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