Import comments on the diff of a GitHub Pull Request into GitLab

This commit is contained in:
Douglas Barbosa Alexandre 2015-12-21 19:09:09 -02:00
parent 223f7f5345
commit f19bf0eaa7
1 changed files with 16 additions and 0 deletions

View File

@ -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