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
Boxiang Sun
gitlab-ce
Commits
97c3aff1
Commit
97c3aff1
authored
Apr 14, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored import stuff, moved to lib
parent
adbcccb4
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
app/services/projects/import_export/import_service.rb
app/services/projects/import_export/import_service.rb
+1
-1
lib/gitlab/import_export/members_mapper.rb
lib/gitlab/import_export/members_mapper.rb
+1
-1
lib/gitlab/import_export/project_factory.rb
lib/gitlab/import_export/project_factory.rb
+1
-1
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+5
-5
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+1
-1
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+2
-2
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+2
-2
No files found.
app/services/projects/import_export/import_service.rb
View file @
97c3aff1
...
...
@@ -8,7 +8,7 @@ module Projects
private
def
restore_project_tree
Projects
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
@import_path
).
restore
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
@import_path
).
restore
end
def
restore_repo
...
...
app/services/projects
/import_export/members_mapper.rb
→
lib/gitlab
/import_export/members_mapper.rb
View file @
97c3aff1
module
Projects
module
Gitlab
module
ImportExport
class
MembersMapper
...
...
app/services/projects
/import_export/project_factory.rb
→
lib/gitlab
/import_export/project_factory.rb
View file @
97c3aff1
module
Projects
module
Gitlab
module
ImportExport
module
ProjectFactory
extend
self
...
...
app/services/projects
/import_export/project_tree_restorer.rb
→
lib/gitlab
/import_export/project_tree_restorer.rb
View file @
97c3aff1
module
Projects
module
Gitlab
module
ImportExport
class
ProjectTreeRestorer
attr_reader
:project
...
...
@@ -18,7 +18,7 @@ module Projects
private
def
members_map
@members
||=
Projects
::
ImportExport
::
MembersMapper
.
map
(
@members
||=
Gitlab
::
ImportExport
::
MembersMapper
.
map
(
exported_members:
@project_members
,
user:
@user
,
project_id:
project
.
id
)
end
...
...
@@ -37,7 +37,7 @@ module Projects
end
def
default_relation_list
Projects
::
ImportExport
::
ImportExportReader
.
tree
.
reject
{
|
model
|
model
.
is_a?
(
Hash
)
&&
model
[
:project_members
]
}
Gitlab
::
ImportExport
::
ImportExportReader
.
tree
.
reject
{
|
model
|
model
.
is_a?
(
Hash
)
&&
model
[
:project_members
]
}
end
def
project
...
...
@@ -46,7 +46,7 @@ module Projects
def
create_project
project_params
=
@tree_hash
.
reject
{
|
_key
,
value
|
value
.
is_a?
(
Array
)
}
project
=
Projects
::
ImportExport
::
ProjectFactory
.
create
(
project
=
Gitlab
::
ImportExport
::
ProjectFactory
.
create
(
project_params:
project_params
,
user:
@user
)
project
.
save
project
...
...
@@ -79,7 +79,7 @@ module Projects
end
def
relation_from_factory
(
relation
,
relation_hash
)
Projects
::
ImportExport
::
RelationFactory
.
create
(
Gitlab
::
ImportExport
::
RelationFactory
.
create
(
relation_sym:
relation
,
relation_hash:
relation_hash
.
merge
(
'project_id'
=>
project
.
id
),
members_map:
members_map
)
end
end
...
...
app/services/projects
/import_export/relation_factory.rb
→
lib/gitlab
/import_export/relation_factory.rb
View file @
97c3aff1
module
Projects
module
Gitlab
module
ImportExport
module
RelationFactory
extend
self
...
...
spec/
services/projects
/import_export/members_mapper_spec.rb
→
spec/
lib/gitlab
/import_export/members_mapper_spec.rb
View file @
97c3aff1
require
'spec_helper'
describe
Projects
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
Gitlab
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
:map
do
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -31,7 +31,7 @@ describe Projects::ImportExport::MembersMapper, services: true do
end
let
(
:members_mapper
)
do
Projects
::
ImportExport
::
MembersMapper
.
new
(
Gitlab
::
ImportExport
::
MembersMapper
.
new
(
exported_members:
exported_members
,
user:
user
,
project_id:
project
.
id
)
end
...
...
spec/
services/projects
/import_export/project_tree_restorer_spec.rb
→
spec/
lib/gitlab
/import_export/project_tree_restorer_spec.rb
View file @
97c3aff1
require
'spec_helper'
describe
Projects
::
ImportExport
::
ProjectTreeRestorer
,
services:
true
do
describe
Gitlab
::
ImportExport
::
ProjectTreeRestorer
,
services:
true
do
describe
:restore
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project_tree_restorer
)
{
Projects
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
"fixtures/import_export/project.json"
,
user:
user
)
}
let
(
:project_tree_restorer
)
{
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
"fixtures/import_export/project.json"
,
user:
user
)
}
context
'JSON'
do
let
(
:restored_project_json
)
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