diff options
Diffstat (limited to 'lib/gitlab/bitbucket_import/importers/lfs_object_importer.rb')
-rw-r--r-- | lib/gitlab/bitbucket_import/importers/lfs_object_importer.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/gitlab/bitbucket_import/importers/lfs_object_importer.rb b/lib/gitlab/bitbucket_import/importers/lfs_object_importer.rb new file mode 100644 index 00000000000..06b30c7b496 --- /dev/null +++ b/lib/gitlab/bitbucket_import/importers/lfs_object_importer.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Gitlab + module BitbucketImport + module Importers + class LfsObjectImporter + include Loggable + include ErrorTracking + + def initialize(project, lfs_attributes) + @project = project + @lfs_download_object = LfsDownloadObject.new(**lfs_attributes.symbolize_keys) + end + + def execute + log_info(import_stage: 'import_lfs_object', message: 'starting', oid: lfs_download_object.oid) + + lfs_download_object.validate! + Projects::LfsPointers::LfsDownloadService.new(project, lfs_download_object).execute + + log_info(import_stage: 'import_lfs_object', message: 'finished', oid: lfs_download_object.oid) + rescue StandardError => e + track_import_failure!(project, exception: e) + end + + private + + attr_reader :lfs_download_object, :project + end + end + end +end |