Class: Gitlab::BitbucketServerImport::Importer
- Inherits:
-
Object
- Object
- Gitlab::BitbucketServerImport::Importer
- Defined in:
- lib/gitlab/bitbucket_server_import/importer.rb
Defined Under Namespace
Classes: TempBranch
Constant Summary collapse
- REMOTE_NAME =
'bitbucket_server'
- BATCH_SIZE =
100
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#project_key ⇒ Object
readonly
Returns the value of attribute project_key.
-
#recover_missing_commits ⇒ Object
readonly
Returns the value of attribute recover_missing_commits.
-
#repository_slug ⇒ Object
readonly
Returns the value of attribute repository_slug.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, recover_missing_commits: false) ⇒ Importer
constructor
Unlike GitHub, you can't grab the commit SHAs for pull requests that have been closed but not merged even though Bitbucket has these commits internally.
Constructor Details
#initialize(project, recover_missing_commits: false) ⇒ Importer
Unlike GitHub, you can't grab the commit SHAs for pull requests that have been closed but not merged even though Bitbucket has these commits internally. We can recover these pull requests by creating a branch with the Bitbucket REST API, but by default we turn this behavior off.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 28 def initialize(project, recover_missing_commits: false) @project = project @recover_missing_commits = recover_missing_commits @project_key = project.import_data.data['project_key'] @repository_slug = project.import_data.data['repo_slug'] @client = BitbucketServer::Client.new(project.import_data.credentials) @formatter = Gitlab::ImportFormatter.new @errors = [] @users = {} @temp_branches = [] @logger = Gitlab::Import::Logger.build end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client
7 8 9 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 7 def client @client end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors
7 8 9 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 7 def errors @errors end |
#logger ⇒ Object
Returns the value of attribute logger
8 9 10 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 8 def logger @logger end |
#project ⇒ Object (readonly)
Returns the value of attribute project
7 8 9 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 7 def project @project end |
#project_key ⇒ Object (readonly)
Returns the value of attribute project_key
7 8 9 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 7 def project_key @project_key end |
#recover_missing_commits ⇒ Object (readonly)
Returns the value of attribute recover_missing_commits
6 7 8 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 6 def recover_missing_commits @recover_missing_commits end |
#repository_slug ⇒ Object (readonly)
Returns the value of attribute repository_slug
7 8 9 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 7 def repository_slug @repository_slug end |
#users ⇒ Object (readonly)
Returns the value of attribute users
7 8 9 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 7 def users @users end |
Class Method Details
.imports_repository? ⇒ Boolean
15 16 17 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 15 def self.imports_repository? true end |
.refmap ⇒ Object
19 20 21 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 19 def self.refmap [:heads, :tags, '+refs/pull-requests/*/to:refs/merge-requests/*/head'] end |
Instance Method Details
#execute ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gitlab/bitbucket_server_import/importer.rb', line 41 def execute import_repository import_pull_requests delete_temp_branches handle_errors metrics.track_finished_import log_info(stage: "complete") true end |