Class: Gitlab::BitbucketImport::Importers::RepositoryImporter
- Inherits:
-
Object
- Object
- Gitlab::BitbucketImport::Importers::RepositoryImporter
- Includes:
- Loggable
- Defined in:
- lib/gitlab/bitbucket_import/importers/repository_importer.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project) ⇒ RepositoryImporter
constructor
A new instance of RepositoryImporter.
Methods included from Loggable
#log_debug, #log_error, #log_info, #log_warn
Constructor Details
#initialize(project) ⇒ RepositoryImporter
Returns a new instance of RepositoryImporter.
9 10 11 |
# File 'lib/gitlab/bitbucket_import/importers/repository_importer.rb', line 9 def initialize(project) @project = project end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/bitbucket_import/importers/repository_importer.rb', line 13 def execute log_info(import_stage: 'import_repository', message: 'starting import') if project.empty_repo? project.repository.import_repository(project.import_url) project.repository.fetch_as_mirror(project.import_url, refmap: refmap) validate_repository_size! update_clone_time end import_wiki create_labels log_info(import_stage: 'import_repository', message: 'finished import') true rescue ::Gitlab::Git::CommandError => e Gitlab::ErrorTracking.log_exception( e, import_stage: 'import_repository', message: 'failed import', error: e. ) # Expire cache to prevent scenarios such as: # 1. First import failed, but the repo was imported successfully, so +exists?+ returns true # 2. Retried import, repo is broken or not imported but +exists?+ still returns true project.repository.expire_content_cache if project.repository_exists? raise end |