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
f2977c63
Commit
f2977c63
authored
Nov 20, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bitbucket wiki import with hashed storage enabled
parent
9414bb00
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
changelogs/unreleased/40292-bitbucket-import-hashed-storage.yml
...logs/unreleased/40292-bitbucket-import-hashed-storage.yml
+5
-0
lib/gitlab/bitbucket_import/importer.rb
lib/gitlab/bitbucket_import/importer.rb
+2
-2
spec/lib/gitlab/bitbucket_import/importer_spec.rb
spec/lib/gitlab/bitbucket_import/importer_spec.rb
+30
-3
No files found.
changelogs/unreleased/40292-bitbucket-import-hashed-storage.yml
0 → 100644
View file @
f2977c63
---
title
:
Fix bitbucket wiki import with hashed storage enabled
merge_request
:
15490
author
:
type
:
fixed
lib/gitlab/bitbucket_import/importer.rb
View file @
f2977c63
...
@@ -61,9 +61,9 @@ module Gitlab
...
@@ -61,9 +61,9 @@ module Gitlab
def
import_wiki
def
import_wiki
return
if
project
.
wiki
.
repository_exists?
return
if
project
.
wiki
.
repository_exists?
path_with_namespace
=
"
#{
project
.
full_path
}
.wiki"
disk_path
=
project
.
wiki
.
disk_path
import_url
=
project
.
import_url
.
sub
(
/\.git\z/
,
".git/wiki"
)
import_url
=
project
.
import_url
.
sub
(
/\.git\z/
,
".git/wiki"
)
gitlab_shell
.
import_repository
(
project
.
repository_storage_path
,
path_with_namespace
,
import_url
)
gitlab_shell
.
import_repository
(
project
.
repository_storage_path
,
disk_path
,
import_url
)
rescue
StandardError
=>
e
rescue
StandardError
=>
e
errors
<<
{
type: :wiki
,
errors:
e
.
message
}
errors
<<
{
type: :wiki
,
errors:
e
.
message
}
end
end
...
...
spec/lib/gitlab/bitbucket_import/importer_spec.rb
View file @
f2977c63
...
@@ -54,11 +54,13 @@ describe Gitlab::BitbucketImport::Importer do
...
@@ -54,11 +54,13 @@ describe Gitlab::BitbucketImport::Importer do
create
(
create
(
:project
,
:project
,
import_source:
project_identifier
,
import_source:
project_identifier
,
import_url:
"https://bitbucket.org/
#{
project_identifier
}
.git"
,
import_data_attributes:
{
credentials:
data
}
import_data_attributes:
{
credentials:
data
}
)
)
end
end
let
(
:importer
)
{
described_class
.
new
(
project
)
}
let
(
:importer
)
{
described_class
.
new
(
project
)
}
let
(
:gitlab_shell
)
{
double
}
let
(
:issues_statuses_sample_data
)
do
let
(
:issues_statuses_sample_data
)
do
{
{
...
@@ -67,6 +69,10 @@ describe Gitlab::BitbucketImport::Importer do
...
@@ -67,6 +69,10 @@ describe Gitlab::BitbucketImport::Importer do
}
}
end
end
before
do
allow
(
importer
).
to
receive
(
:gitlab_shell
)
{
gitlab_shell
}
end
context
'issues statuses'
do
context
'issues statuses'
do
before
do
before
do
# HACK: Bitbucket::Representation.const_get('Issue') seems to return ::Issue without this
# HACK: Bitbucket::Representation.const_get('Issue') seems to return ::Issue without this
...
@@ -110,15 +116,36 @@ describe Gitlab::BitbucketImport::Importer do
...
@@ -110,15 +116,36 @@ describe Gitlab::BitbucketImport::Importer do
end
end
it
'maps statuses to open or closed'
do
it
'maps statuses to open or closed'
do
allow
(
importer
).
to
receive
(
:import_wiki
)
importer
.
execute
importer
.
execute
expect
(
project
.
issues
.
where
(
state:
"closed"
).
size
).
to
eq
(
5
)
expect
(
project
.
issues
.
where
(
state:
"closed"
).
size
).
to
eq
(
5
)
expect
(
project
.
issues
.
where
(
state:
"opened"
).
size
).
to
eq
(
2
)
expect
(
project
.
issues
.
where
(
state:
"opened"
).
size
).
to
eq
(
2
)
end
end
it
'calls import_wiki'
do
describe
'wiki import'
do
expect
(
importer
).
to
receive
(
:import_wiki
)
it
'is skipped when the wiki exists'
do
expect
(
project
.
wiki
).
to
receive
(
:repository_exists?
)
{
true
}
expect
(
importer
.
gitlab_shell
).
not_to
receive
(
:import_repository
)
importer
.
execute
importer
.
execute
expect
(
importer
.
errors
).
to
be_empty
end
it
'imports to the project disk_path'
do
expect
(
project
.
wiki
).
to
receive
(
:repository_exists?
)
{
false
}
expect
(
importer
.
gitlab_shell
).
to
receive
(
:import_repository
).
with
(
project
.
repository_storage_path
,
project
.
wiki
.
disk_path
,
project
.
import_url
+
'/wiki'
)
importer
.
execute
expect
(
importer
.
errors
).
to
be_empty
end
end
end
end
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