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
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2015-12-22 00:09:09 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-01-05 20:24:55 +0300
commitf19bf0eaa73007081f2ab10f6a0fb176d5356e36 (patch)
treea64c77195cb80c3d2c8c972a251f39e925d0c7d9 /lib
parent223f7f53453d544a8c46c75ca9c54b8b60620961 (diff)
Import comments on the diff of a GitHub Pull Request into GitLab
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/github_import/importer.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index 35a2930d4a1..4b753d24601 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -81,6 +81,18 @@ module Gitlab
updated_at: c.updated_at
)
end
+
+ client.pull_request_comments(project.import_source, pull_request.number).each do |c|
+ merge_request.notes.create!(
+ project: project,
+ note: format_body(c.user.login, c.body),
+ commit_id: c.commit_id,
+ line_code: generate_line_code(c.path, c.position),
+ author_id: gl_author_id(project, c.user.id),
+ created_at: c.created_at,
+ updated_at: c.updated_at
+ )
+ end
end
end
@@ -99,6 +111,10 @@ module Gitlab
end
end
+ def generate_line_code(file_path, position)
+ Gitlab::Diff::LineCode.generate(file_path, position, 0)
+ end
+
def gl_author_id(project, github_id)
gl_user_id(github_id) || project.creator_id
end