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
11c29cca
Commit
11c29cca
authored
Jan 24, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
2b0da92b
de3af288
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
changelogs/unreleased/sh-remove-bitbucket-mirror-constant.yml
...gelogs/unreleased/sh-remove-bitbucket-mirror-constant.yml
+5
-0
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+2
-2
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
+13
-4
No files found.
changelogs/unreleased/sh-remove-bitbucket-mirror-constant.yml
0 → 100644
View file @
11c29cca
---
title
:
Fix import handling errors in Bitbucket Server importer
merge_request
:
24499
author
:
type
:
fixed
lib/gitlab/bitbucket_server_import/importer.rb
View file @
11c29cca
...
...
@@ -132,7 +132,7 @@ module Gitlab
project
.
repository
.
fetch_as_mirror
(
project
.
import_url
,
refmap:
self
.
class
.
refmap
,
remote_name:
REMOTE_NAME
)
log_info
(
stage:
'import_repository'
,
message:
'finished import'
)
rescue
Gitlab
::
Shell
::
Error
,
Gitlab
::
Git
::
RepositoryMirroring
::
RemoteError
=>
e
rescue
Gitlab
::
Shell
::
Error
=>
e
log_error
(
stage:
'import_repository'
,
message:
'failed import'
,
error:
e
.
message
)
# Expire cache to prevent scenarios such as:
...
...
@@ -140,7 +140,7 @@ module Gitlab
# 2. Retried import, repo is broken or not imported but +exists?+ still returns true
project
.
repository
.
expire_content_cache
if
project
.
repository_exists?
raise
e
.
message
raise
end
# Bitbucket Server keeps tracks of references for open pull requests in
...
...
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
View file @
11c29cca
...
...
@@ -21,12 +21,9 @@ describe Gitlab::BitbucketServerImport::Importer do
end
describe
'#import_repository'
do
before
do
it
'adds a remote'
do
expect
(
subject
).
to
receive
(
:import_pull_requests
)
expect
(
subject
).
to
receive
(
:delete_temp_branches
)
end
it
'adds a remote'
do
expect
(
project
.
repository
).
to
receive
(
:fetch_as_mirror
)
.
with
(
'http://bitbucket:test@my-bitbucket'
,
refmap:
[
:heads
,
:tags
,
'+refs/pull-requests/*/to:refs/merge-requests/*/head'
],
...
...
@@ -34,6 +31,18 @@ describe Gitlab::BitbucketServerImport::Importer do
subject
.
execute
end
it
'raises a Gitlab::Shell exception in the fetch'
do
expect
(
project
.
repository
).
to
receive
(
:fetch_as_mirror
).
and_raise
(
Gitlab
::
Shell
::
Error
)
expect
{
subject
.
execute
}.
to
raise_error
(
Gitlab
::
Shell
::
Error
)
end
it
'raises an unhandled exception in the fetch'
do
expect
(
project
.
repository
).
to
receive
(
:fetch_as_mirror
).
and_raise
(
RuntimeError
)
expect
{
subject
.
execute
}.
to
raise_error
(
RuntimeError
)
end
end
describe
'#import_pull_requests'
do
...
...
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