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
Jérome Perrin
gitlab-ce
Commits
2986de7c
Commit
2986de7c
authored
Aug 24, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add readable error message when remote data could not be fully imported
parent
3c09000e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
lib/gitlab/github_import/importer.rb
lib/gitlab/github_import/importer.rb
+6
-1
spec/lib/gitlab/github_import/importer_spec.rb
spec/lib/gitlab/github_import/importer_spec.rb
+13
-10
No files found.
lib/gitlab/github_import/importer.rb
View file @
2986de7c
...
@@ -36,7 +36,12 @@ module Gitlab
...
@@ -36,7 +36,12 @@ module Gitlab
end
end
def
handle_errors
def
handle_errors
project
.
update_column
(
:import_error
,
errors
.
to_json
)
unless
errors
.
empty?
return
unless
errors
.
any?
project
.
update_column
(
:import_error
,
{
message:
'The remote data could not be fully imported.'
,
errors:
errors
}.
to_json
)
end
end
def
import_labels
def
import_labels
...
...
spec/lib/gitlab/github_import/importer_spec.rb
View file @
2986de7c
...
@@ -110,7 +110,9 @@ describe Gitlab::GithubImport::Importer, lib: true do
...
@@ -110,7 +110,9 @@ describe Gitlab::GithubImport::Importer, lib: true do
end
end
it
'stores error messages'
do
it
'stores error messages'
do
errors
=
[
error
=
{
message:
'The remote data could not be fully imported.'
,
errors:
[
{
type: :label
,
url:
"https://api.github.com/repos/octocat/Hello-World/labels/bug"
,
errors:
"Validation failed: Title has already been taken"
},
{
type: :label
,
url:
"https://api.github.com/repos/octocat/Hello-World/labels/bug"
,
errors:
"Validation failed: Title has already been taken"
},
{
type: :milestone
,
url:
"https://api.github.com/repos/octocat/Hello-World/milestones/1"
,
errors:
"Validation failed: Title has already been taken"
},
{
type: :milestone
,
url:
"https://api.github.com/repos/octocat/Hello-World/milestones/1"
,
errors:
"Validation failed: Title has already been taken"
},
{
type: :issue
,
url:
"https://api.github.com/repos/octocat/Hello-World/issues/1347"
,
errors:
"Invalid Repository. Use user/repo format."
},
{
type: :issue
,
url:
"https://api.github.com/repos/octocat/Hello-World/issues/1347"
,
errors:
"Invalid Repository. Use user/repo format."
},
...
@@ -119,10 +121,11 @@ describe Gitlab::GithubImport::Importer, lib: true do
...
@@ -119,10 +121,11 @@ describe Gitlab::GithubImport::Importer, lib: true do
{
type: :pull_request
,
url:
"https://api.github.com/repos/octocat/Hello-World/pulls/1347"
,
errors:
"Validation failed: Validate branches Cannot Create: This merge request already exists: [
\"
New feature
\"
]"
},
{
type: :pull_request
,
url:
"https://api.github.com/repos/octocat/Hello-World/pulls/1347"
,
errors:
"Validation failed: Validate branches Cannot Create: This merge request already exists: [
\"
New feature
\"
]"
},
{
type: :wiki
,
errors:
"Gitlab::Shell::Error"
}
{
type: :wiki
,
errors:
"Gitlab::Shell::Error"
}
]
]
}
described_class
.
new
(
project
).
execute
described_class
.
new
(
project
).
execute
expect
(
project
.
import_error
).
to
eq
error
s
.
to_json
expect
(
project
.
import_error
).
to
eq
error
.
to_json
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