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
Boxiang Sun
gitlab-ce
Commits
591bf92c
Commit
591bf92c
authored
Feb 22, 2016
by
Iuri de Silvio
Committed by
Rémy Coutable
Mar 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where Bitbucket `closed` issues were imported as `opened`
parent
903aa7c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
1 deletion
+90
-1
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/bitbucket_import/importer.rb
lib/gitlab/bitbucket_import/importer.rb
+1
-1
spec/lib/gitlab/bitbucket_import/importer_spec.rb
spec/lib/gitlab/bitbucket_import/importer_spec.rb
+88
-0
No files found.
CHANGELOG
View file @
591bf92c
...
...
@@ -12,6 +12,7 @@ v 8.6.0 (unreleased)
- Add support for cross-project label references
- Update documentation to reflect Guest role not being enforced on internal projects
- Allow search for logged out users
- Fix bug where Bitbucket `closed` issues were imported as `opened` (Iuri de Silvio)
- Don't show Issues/MRs from archived projects in Groups view
- Increase the notes polling timeout over time (Roberto Dip)
- Show labels in dashboard and group milestone views
...
...
lib/gitlab/bitbucket_import/importer.rb
View file @
591bf92c
...
...
@@ -76,7 +76,7 @@ module Gitlab
project
.
issues
.
create!
(
description:
body
,
title:
issue
[
"title"
],
state:
%w(resolved invalid duplicate wontfix)
.
include?
(
issue
[
"status"
])
?
'closed'
:
'opened'
,
state:
%w(resolved invalid duplicate wontfix
closed
)
.
include?
(
issue
[
"status"
])
?
'closed'
:
'opened'
,
author_id:
gl_user_id
(
project
,
reporter
)
)
end
...
...
spec/lib/gitlab/bitbucket_import/importer_spec.rb
0 → 100644
View file @
591bf92c
require
'spec_helper'
describe
Gitlab
::
BitbucketImport
::
Importer
,
lib:
true
do
before
do
Gitlab
.
config
.
omniauth
.
providers
<<
OpenStruct
.
new
(
app_id:
"asd123"
,
app_secret:
"asd123"
,
name:
"bitbucket"
)
end
let
(
:statuses
)
do
[
"open"
,
"resolved"
,
"on hold"
,
"invalid"
,
"duplicate"
,
"wontfix"
,
"closed"
# undocumented status
]
end
let
(
:sample_issues_statuses
)
do
issues
=
[]
statuses
.
map
.
with_index
do
|
status
,
index
|
issues
<<
{
local_id:
index
,
status:
status
,
title:
"Issue
#{
index
}
"
,
content:
"Some content to issue
#{
index
}
"
}
end
issues
end
let
(
:project_identifier
)
{
'namespace/repo'
}
let
(
:data
)
do
{
bb_session:
{
bitbucket_access_token:
"123456"
,
bitbucket_access_token_secret:
"secret"
}
}
end
let
(
:project
)
do
create
(
:project
,
import_source:
project_identifier
,
import_data:
ProjectImportData
.
new
(
data:
data
)
)
end
let
(
:importer
)
{
Gitlab
::
BitbucketImport
::
Importer
.
new
(
project
)
}
let
(
:issues_statuses_sample_data
)
do
{
count:
sample_issues_statuses
.
count
,
issues:
sample_issues_statuses
}
end
context
'issues statuses'
do
before
do
stub_request
(
:get
,
"https://bitbucket.org/api/1.0/repositories/
#{
project_identifier
}
"
).
to_return
(
status:
200
,
body:
{
has_issues:
true
}.
to_json
)
stub_request
(
:get
,
"https://bitbucket.org/api/1.0/repositories/
#{
project_identifier
}
/issues?limit=50&sort=utc_created_on&start=0"
).
to_return
(
status:
200
,
body:
issues_statuses_sample_data
.
to_json
)
sample_issues_statuses
.
each_with_index
do
|
issue
,
index
|
stub_request
(
:get
,
"https://bitbucket.org/api/1.0/repositories/
#{
project_identifier
}
/issues/
#{
issue
[
:local_id
]
}
/comments"
).
to_return
(
status:
200
,
body:
[{
author_info:
{
username:
"username"
},
utc_created_on:
index
}].
to_json
)
end
end
it
'map statuses to open or closed'
do
importer
.
execute
expect
(
project
.
issues
.
where
(
state:
"closed"
).
size
).
to
eq
(
5
)
expect
(
project
.
issues
.
where
(
state:
"opened"
).
size
).
to
eq
(
2
)
end
end
end
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