Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-20 09:08:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-20 09:08:54 +0300
commit9558f52fd8da408c4ef7ecfb792902cbe91e4e64 (patch)
treea70e65b2ac7ecc07d474f466fc15ac9581cfccdf /app
parent8f61d9504700eace5f1f82a45bfc62414fd17807 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/models/bulk_imports/file_transfer/project_config.rb3
-rw-r--r--app/services/bulk_imports/file_export_service.rb2
-rw-r--r--app/services/bulk_imports/repository_bundle_export_service.rb25
3 files changed, 29 insertions, 1 deletions
diff --git a/app/models/bulk_imports/file_transfer/project_config.rb b/app/models/bulk_imports/file_transfer/project_config.rb
index 38884df9fcf..67502b6f351 100644
--- a/app/models/bulk_imports/file_transfer/project_config.rb
+++ b/app/models/bulk_imports/file_transfer/project_config.rb
@@ -9,6 +9,7 @@ module BulkImports
).freeze
LFS_OBJECTS_RELATION = 'lfs_objects'
+ REPOSITORY_BUNDLE_RELATION = 'repository_bundle'
def import_export_yaml
::Gitlab::ImportExport.config_file
@@ -19,7 +20,7 @@ module BulkImports
end
def file_relations
- [UPLOADS_RELATION, LFS_OBJECTS_RELATION]
+ [UPLOADS_RELATION, LFS_OBJECTS_RELATION, REPOSITORY_BUNDLE_RELATION]
end
end
end
diff --git a/app/services/bulk_imports/file_export_service.rb b/app/services/bulk_imports/file_export_service.rb
index a9d06d84277..68f5fcc45a1 100644
--- a/app/services/bulk_imports/file_export_service.rb
+++ b/app/services/bulk_imports/file_export_service.rb
@@ -30,6 +30,8 @@ module BulkImports
UploadsExportService.new(portable, export_path)
when FileTransfer::ProjectConfig::LFS_OBJECTS_RELATION
LfsObjectsExportService.new(portable, export_path)
+ when FileTransfer::ProjectConfig::REPOSITORY_BUNDLE_RELATION
+ RepositoryBundleExportService.new(portable, export_path)
else
raise BulkImports::Error, 'Unsupported relation export type'
end
diff --git a/app/services/bulk_imports/repository_bundle_export_service.rb b/app/services/bulk_imports/repository_bundle_export_service.rb
new file mode 100644
index 00000000000..9d8371dd086
--- /dev/null
+++ b/app/services/bulk_imports/repository_bundle_export_service.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module BulkImports
+ class RepositoryBundleExportService
+ FILENAME = 'project.bundle'
+
+ def initialize(portable, export_path)
+ @portable = portable
+ @export_path = export_path
+ @repository = portable.repository
+ end
+
+ def execute
+ repository.bundle_to_disk(bundle_filepath) if repository.exists?
+ end
+
+ private
+
+ attr_reader :portable, :export_path, :repository
+
+ def bundle_filepath
+ File.join(export_path, FILENAME)
+ end
+ end
+end