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
9f5dd2de
Commit
9f5dd2de
authored
May 05, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handling errors a bit better on import failure
parent
9c60eca8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
14 deletions
+22
-14
app/workers/project_import_worker.rb
app/workers/project_import_worker.rb
+9
-9
lib/gitlab/import_export/import_service.rb
lib/gitlab/import_export/import_service.rb
+10
-4
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+3
-1
No files found.
app/workers/project_import_worker.rb
View file @
9f5dd2de
...
...
@@ -11,15 +11,15 @@ class ProjectImportWorker
owner:
current_user
,
namespace_id:
namespace_id
,
project_path:
path
)
if
project
project
.
repository
.
after_import
project
.
import_finish
else
logger
.
error
(
"There was an error during the import:
#{
tmpfile
}
"
)
end
end
# TODO: Move this to import service
# if result[:status] == :error
# project.update(import_error: result[:message])
# project.import_fail
# return
# end
project
.
repository
.
after_import
project
.
import_finish
def
logger
Sidekiq
.
logger
end
end
lib/gitlab/import_export/import_service.rb
View file @
9f5dd2de
...
...
@@ -14,7 +14,8 @@ module Gitlab
end
def
execute
Gitlab
::
ImportExport
::
Importer
.
import
(
archive_file:
@archive_file
,
storage_path:
storage_path
)
Gitlab
::
ImportExport
::
Importer
.
import
(
archive_file:
@archive_file
,
storage_path:
storage_path
)
project_tree
.
project
if
[
restore_project_tree
,
restore_repo
,
restore_wiki_repo
].
all?
end
...
...
@@ -25,15 +26,20 @@ module Gitlab
end
def
project_tree
@project_tree
||=
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
storage_path
,
user:
@current_user
,
project_path:
@project_path
,
namespace_id:
@namespace
.
id
)
@project_tree
||=
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
storage_path
,
user:
@current_user
,
project_path:
@project_path
,
namespace_id:
@namespace
.
id
)
end
def
restore_repo
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path_to_bundle:
repo_path
,
project:
project_tree
.
project
).
restore
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path_to_bundle:
repo_path
,
project:
project_tree
.
project
).
restore
end
def
restore_wiki_repo
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path_to_bundle:
wiki_repo_path
,
project:
ProjectWiki
.
new
(
project_tree
.
project
)).
restore
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path_to_bundle:
wiki_repo_path
,
project:
ProjectWiki
.
new
(
project_tree
.
project
)).
restore
end
def
storage_path
...
...
lib/gitlab/import_export/project_tree_restorer.rb
View file @
9f5dd2de
...
...
@@ -14,6 +14,8 @@ module Gitlab
@tree_hash
=
ActiveSupport
::
JSON
.
decode
(
json
)
@project_members
=
@tree_hash
.
delete
(
'project_members'
)
create_relations
rescue
false
end
def
project
...
...
@@ -50,7 +52,7 @@ module Gitlab
project_params:
project_params
,
user:
@user
,
namespace_id:
@namespace_id
)
project
.
path
=
@project_path
project
.
name
=
@project_path
project
.
save
project
.
save
!
project
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