Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
6c846ef8
Commit
6c846ef8
authored
Dec 21, 2015
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract methods to import comments on a GitHub Pull Request
parent
d72b2581
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
24 deletions
+28
-24
lib/gitlab/github_import/importer.rb
lib/gitlab/github_import/importer.rb
+28
-24
No files found.
lib/gitlab/github_import/importer.rb
View file @
6c846ef8
...
@@ -56,7 +56,6 @@ module Gitlab
...
@@ -56,7 +56,6 @@ module Gitlab
target_branch
=
find_branch
(
pull_request
.
base
.
ref
)
target_branch
=
find_branch
(
pull_request
.
base
.
ref
)
if
source_branch
&&
target_branch
if
source_branch
&&
target_branch
# Pull Request
merge_request
=
MergeRequest
.
create!
(
merge_request
=
MergeRequest
.
create!
(
title:
pull_request
.
title
,
title:
pull_request
.
title
,
description:
format_body
(
pull_request
.
user
.
login
,
pull_request
.
body
),
description:
format_body
(
pull_request
.
user
.
login
,
pull_request
.
body
),
...
@@ -71,7 +70,13 @@ module Gitlab
...
@@ -71,7 +70,13 @@ module Gitlab
updated_at:
pull_request
.
updated_at
updated_at:
pull_request
.
updated_at
)
)
# Comments on Pull Request
import_comments_on_pull_request
(
merge_request
,
pull_request
)
import_comments_on_pull_request_diff
(
merge_request
,
pull_request
)
end
end
end
def
import_comments_on_pull_request
(
merge_request
,
pull_request
)
client
.
issue_comments
(
project
.
import_source
,
pull_request
.
number
).
each
do
|
c
|
client
.
issue_comments
(
project
.
import_source
,
pull_request
.
number
).
each
do
|
c
|
merge_request
.
notes
.
create!
(
merge_request
.
notes
.
create!
(
project:
project
,
project:
project
,
...
@@ -81,8 +86,9 @@ module Gitlab
...
@@ -81,8 +86,9 @@ module Gitlab
updated_at:
c
.
updated_at
updated_at:
c
.
updated_at
)
)
end
end
end
# Comments on Pull Request diff
def
import_comments_on_pull_request_diff
(
merge_request
,
pull_request
)
client
.
pull_request_comments
(
project
.
import_source
,
pull_request
.
number
).
each
do
|
c
|
client
.
pull_request_comments
(
project
.
import_source
,
pull_request
.
number
).
each
do
|
c
|
merge_request
.
notes
.
create!
(
merge_request
.
notes
.
create!
(
project:
project
,
project:
project
,
...
@@ -95,8 +101,6 @@ module Gitlab
...
@@ -95,8 +101,6 @@ module Gitlab
)
)
end
end
end
end
end
end
def
find_branch
(
name
)
def
find_branch
(
name
)
project
.
repository
.
find_branch
(
name
)
project
.
repository
.
find_branch
(
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment