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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c9a44e5d
Commit
c9a44e5d
authored
Oct 22, 2020
by
Kassio Borges
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Download LFS files when importing from Bitbucket Server
parent
cfc6a8bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
changelogs/unreleased/kassio-fix-bitbucket-server-importer-lfs.yml
...s/unreleased/kassio-fix-bitbucket-server-importer-lfs.yml
+5
-0
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+9
-0
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
+32
-0
No files found.
changelogs/unreleased/kassio-fix-bitbucket-server-importer-lfs.yml
0 → 100644
View file @
c9a44e5d
---
title
:
Download LFS files when importing from Bitbucket Server
merge_request
:
45908
author
:
type
:
fixed
lib/gitlab/bitbucket_server_import/importer.rb
View file @
c9a44e5d
...
...
@@ -41,6 +41,7 @@ module Gitlab
def
execute
import_repository
import_pull_requests
download_lfs_objects
delete_temp_branches
handle_errors
metrics
.
track_finished_import
...
...
@@ -148,6 +149,14 @@ module Gitlab
raise
end
def
download_lfs_objects
result
=
Projects
::
LfsPointers
::
LfsImportService
.
new
(
project
).
execute
if
result
[
:status
]
==
:error
errors
<<
{
type: :lfs_objects
,
errors:
"The Lfs import process failed.
#{
result
[
:message
]
}
"
}
end
end
# Bitbucket Server keeps tracks of references for open pull requests in
# refs/heads/pull-requests, but closed and merged requests get moved
# into hidden internal refs under stash-refs/pull-requests. Unless the
...
...
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
View file @
c9a44e5d
...
...
@@ -525,4 +525,36 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer do
expect
{
subject
.
execute
}.
to
change
{
MergeRequest
.
count
}.
by
(
1
)
end
end
context
"lfs files"
do
before
do
allow
(
project
).
to
receive
(
:lfs_enabled?
).
and_return
(
true
)
allow
(
subject
).
to
receive
(
:import_repository
)
allow
(
subject
).
to
receive
(
:import_pull_requests
)
end
it
"downloads lfs objects if lfs_enabled is enabled for project"
do
expect_next_instance_of
(
Projects
::
LfsPointers
::
LfsImportService
)
do
|
lfs_import_service
|
expect
(
lfs_import_service
).
to
receive
(
:execute
).
and_return
(
status: :success
)
end
subject
.
execute
end
it
"adds the error message when the lfs download fails"
do
allow_next_instance_of
(
Projects
::
LfsPointers
::
LfsImportService
)
do
|
lfs_import_service
|
expect
(
lfs_import_service
).
to
receive
(
:execute
).
and_return
(
status: :error
,
message:
"LFS server not reachable"
)
end
subject
.
execute
expect
(
project
.
import_state
.
reload
.
last_error
).
to
eq
(
Gitlab
::
Json
.
dump
({
message:
"The remote data could not be fully imported."
,
errors:
[{
type:
"lfs_objects"
,
errors:
"The Lfs import process failed. LFS server not reachable"
}]
}))
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