summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-11-04 18:48:41 +0000
committerSean McGivern <sean@mcgivern.me.uk>2016-11-04 18:48:41 +0000
commit8d0d8b91e46573e8fe46dc712e84c65708a00b97 (patch)
tree5691f8566fa7f98fe1a14b76c2779a6fe940b5fd /lib
parent86b8fb4e7f376bdb70faf8ce99f34b6ec0fc8dc1 (diff)
parenteaa0303b3d2f1480222c94a85d356b055f7100b3 (diff)
downloadgitlab-ce-8d0d8b91e46573e8fe46dc712e84c65708a00b97.tar.gz
Merge branch 'fix/gh-imported-labels-are-not-applied-correctly' into 'master'
Fix applying GitHub-imported labels when importing job is interrupted Closes #24075 See merge request !7245
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/github_import/importer.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index ecc28799737..90cf38a8513 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -52,13 +52,14 @@ module Gitlab
fetch_resources(:labels, repo, per_page: 100) do |labels|
labels.each do |raw|
begin
- label = LabelFormatter.new(project, raw).create!
- @labels[label.title] = label.id
+ LabelFormatter.new(project, raw).create!
rescue => e
errors << { type: :label, url: Gitlab::UrlSanitizer.sanitize(raw.url), errors: e.message }
end
end
end
+
+ cache_labels!
end
def import_milestones
@@ -234,6 +235,12 @@ module Gitlab
end
end
+ def cache_labels!
+ project.labels.select(:id, :title).find_each do |label|
+ @labels[label.title] = label.id
+ end
+ end
+
def fetch_resources(resource_type, *opts)
return if imported?(resource_type)