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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/bitbucket_import/importer.rb')
-rw-r--r--lib/gitlab/bitbucket_import/importer.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb
index d58de7eb211..7de6be45349 100644
--- a/lib/gitlab/bitbucket_import/importer.rb
+++ b/lib/gitlab/bitbucket_import/importer.rb
@@ -67,6 +67,14 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
+ def allocate_issues_internal_id!(project, client)
+ last_bitbucket_issue = client.last_issue(repo)
+
+ return unless last_bitbucket_issue
+
+ Issue.track_project_iid!(project, last_bitbucket_issue.iid)
+ end
+
def repo
@repo ||= client.repo(project.import_source)
end
@@ -84,6 +92,10 @@ module Gitlab
def import_issues
return unless repo.issues_enabled?
+ # If a user creates an issue while the import is in progress, this can lead to an import failure.
+ # The workaround is to allocate IIDs before starting the importer.
+ allocate_issues_internal_id!(project, client)
+
create_labels
issue_type_id = WorkItems::Type.default_issue_type.id