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/github_import/importer.rb')
-rw-r--r--lib/gitlab/github_import/importer.rb46
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
deleted file mode 100644
index 23832b3233c..00000000000
--- a/lib/gitlab/github_import/importer.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-module Gitlab
- module GithubImport
- class Importer
- attr_reader :project, :client
-
- def initialize(project)
- @project = project
- @client = Client.new(project.creator.github_access_token)
- @formatter = Gitlab::ImportFormatter.new
- end
-
- def execute
- #Issues && Comments
- client.list_issues(project.import_source, state: :all).each do |issue|
- if issue.pull_request.nil?
-
- body = @formatter.author_line(issue.user.login, issue.body)
-
- if issue.comments > 0
- body += @formatter.comments_header
-
- client.issue_comments(project.import_source, issue.number).each do |c|
- body += @formatter.comment(c.user.login, c.created_at, c.body)
- end
- end
-
- project.issues.create!(
- description: body,
- title: issue.title,
- state: issue.state == 'closed' ? 'closed' : 'opened',
- author_id: gl_user_id(project, issue.user.id)
- )
- end
- end
- end
-
- private
-
- def gl_user_id(project, github_id)
- user = User.joins(:identities).
- find_by("identities.extern_uid = ? AND identities.provider = 'github'", github_id.to_s)
- (user && user.id) || project.creator_id
- end
- end
- end
-end