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
Tatuya Kamada
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
...
@@ -60,8 +60,6 @@ module Gitlab
create_labels
create_labels
gitlab_issue
=
nil
client
.
issues
(
repo
).
each
do
|
issue
|
client
.
issues
(
repo
).
each
do
|
issue
|
begin
begin
description
=
''
description
=
''
...
@@ -87,31 +85,33 @@ module Gitlab
...
@@ -87,31 +85,33 @@ module Gitlab
gitlab_issue
.
labels
<<
@labels
[
label_name
]
gitlab_issue
.
labels
<<
@labels
[
label_name
]
if
gitlab_issue
.
persisted?
import_issue_comments
(
issue
,
gitlab_issue
)
if
gitlab_issue
.
persisted?
client
.
issue_comments
(
repo
,
issue
.
iid
).
each
do
|
comment
|
end
# The note can be blank for issue service messages like "Changed title: ..."
end
# 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.
def
import_issue_comments
(
issue
,
gitlab_issue
)
# To prevent our importer from just crashing or from creating useless empty comments
client
.
issue_comments
(
repo
,
issue
.
iid
).
each
do
|
comment
|
# we do this check.
# The note can be blank for issue service messages like "Changed title: ..."
next
unless
comment
.
note
.
present?
# 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.
note
=
''
# To prevent our importer from just crashing or from creating useless empty comments
note
+=
@formatter
.
author_line
(
comment
.
author
)
unless
find_user_id
(
comment
.
author
)
# we do this check.
note
+=
comment
.
note
next
unless
comment
.
note
.
present?
begin
note
=
''
gitlab_issue
.
notes
.
create!
(
note
+=
@formatter
.
author_line
(
comment
.
author
)
unless
find_user_id
(
comment
.
author
)
project:
project
,
note
+=
comment
.
note
note:
note
,
author_id:
gitlab_user_id
(
project
,
comment
.
author
),
begin
created_at:
comment
.
created_at
,
gitlab_issue
.
notes
.
create!
(
updated_at:
comment
.
updated_at
project:
project
,
)
note:
note
,
rescue
StandardError
=>
e
author_id:
gitlab_user_id
(
project
,
comment
.
author
),
errors
<<
{
type: :issue_comment
,
iid:
issue
.
iid
,
errors:
e
.
message
}
created_at:
comment
.
created_at
,
end
updated_at:
comment
.
updated_at
end
)
rescue
StandardError
=>
e
errors
<<
{
type: :issue_comment
,
iid:
issue
.
iid
,
errors:
e
.
message
}
end
end
end
end
end
end
...
...
spec/lib/bitbucket/representation/issue_spec.rb
View file @
dbe2ac8c
...
@@ -14,7 +14,6 @@ describe Bitbucket::Representation::Issue do
...
@@ -14,7 +14,6 @@ describe Bitbucket::Representation::Issue do
it
{
expect
(
described_class
.
new
({}).
milestone
).
to
be_nil
}
it
{
expect
(
described_class
.
new
({}).
milestone
).
to
be_nil
}
end
end
describe
'#author'
do
describe
'#author'
do
it
{
expect
(
described_class
.
new
({
'reporter'
=>
{
'username'
=>
'Ben'
}
}).
author
).
to
eq
(
'Ben'
)
}
it
{
expect
(
described_class
.
new
({
'reporter'
=>
{
'username'
=>
'Ben'
}
}).
author
).
to
eq
(
'Ben'
)
}
it
{
expect
(
described_class
.
new
({}).
author
).
to
be_nil
}
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