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
Léo-Paul Géneau
gitlab-ce
Commits
dbe2ac8c
Commit
dbe2ac8c
authored
Dec 16, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubucop offenses
parent
20e472d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
28 deletions
+27
-28
lib/gitlab/bitbucket_import/importer.rb
lib/gitlab/bitbucket_import/importer.rb
+27
-27
spec/lib/bitbucket/representation/issue_spec.rb
spec/lib/bitbucket/representation/issue_spec.rb
+0
-1
No files found.
lib/gitlab/bitbucket_import/importer.rb
View file @
dbe2ac8c
...
...
@@ -60,8 +60,6 @@ module Gitlab
create_labels
gitlab_issue
=
nil
client
.
issues
(
repo
).
each
do
|
issue
|
begin
description
=
''
...
...
@@ -87,31 +85,33 @@ module Gitlab
gitlab_issue
.
labels
<<
@labels
[
label_name
]
if
gitlab_issue
.
persisted?
client
.
issue_comments
(
repo
,
issue
.
iid
).
each
do
|
comment
|
# The note can be blank for issue service messages like "Changed title: ..."
# We would like to import those comments as well but there is no any
# specific parameter that would allow to process them, it's just an empty comment.
# To prevent our importer from just crashing or from creating useless empty comments
# we do this check.
next
unless
comment
.
note
.
present?
note
=
''
note
+=
@formatter
.
author_line
(
comment
.
author
)
unless
find_user_id
(
comment
.
author
)
note
+=
comment
.
note
begin
gitlab_issue
.
notes
.
create!
(
project:
project
,
note:
note
,
author_id:
gitlab_user_id
(
project
,
comment
.
author
),
created_at:
comment
.
created_at
,
updated_at:
comment
.
updated_at
)
rescue
StandardError
=>
e
errors
<<
{
type: :issue_comment
,
iid:
issue
.
iid
,
errors:
e
.
message
}
end
end
import_issue_comments
(
issue
,
gitlab_issue
)
if
gitlab_issue
.
persisted?
end
end
def
import_issue_comments
(
issue
,
gitlab_issue
)
client
.
issue_comments
(
repo
,
issue
.
iid
).
each
do
|
comment
|
# The note can be blank for issue service messages like "Changed title: ..."
# We would like to import those comments as well but there is no any
# specific parameter that would allow to process them, it's just an empty comment.
# To prevent our importer from just crashing or from creating useless empty comments
# we do this check.
next
unless
comment
.
note
.
present?
note
=
''
note
+=
@formatter
.
author_line
(
comment
.
author
)
unless
find_user_id
(
comment
.
author
)
note
+=
comment
.
note
begin
gitlab_issue
.
notes
.
create!
(
project:
project
,
note:
note
,
author_id:
gitlab_user_id
(
project
,
comment
.
author
),
created_at:
comment
.
created_at
,
updated_at:
comment
.
updated_at
)
rescue
StandardError
=>
e
errors
<<
{
type: :issue_comment
,
iid:
issue
.
iid
,
errors:
e
.
message
}
end
end
end
...
...
spec/lib/bitbucket/representation/issue_spec.rb
View file @
dbe2ac8c
...
...
@@ -14,7 +14,6 @@ describe Bitbucket::Representation::Issue do
it
{
expect
(
described_class
.
new
({}).
milestone
).
to
be_nil
}
end
describe
'#author'
do
it
{
expect
(
described_class
.
new
({
'reporter'
=>
{
'username'
=>
'Ben'
}
}).
author
).
to
eq
(
'Ben'
)
}
it
{
expect
(
described_class
.
new
({}).
author
).
to
be_nil
}
...
...
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