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
49cdb778
Commit
49cdb778
authored
May 06, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
few fixes to import specs and code
parent
4290e9c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+3
-2
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.json
spec/lib/gitlab/import_export/project.json
+0
-0
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.
lib/gitlab/import_export/project_tree_restorer.rb
View file @
49cdb778
...
@@ -14,7 +14,8 @@ module Gitlab
...
@@ -14,7 +14,8 @@ module Gitlab
@tree_hash
=
ActiveSupport
::
JSON
.
decode
(
json
)
@tree_hash
=
ActiveSupport
::
JSON
.
decode
(
json
)
@project_members
=
@tree_hash
.
delete
(
'project_members'
)
@project_members
=
@tree_hash
.
delete
(
'project_members'
)
create_relations
create_relations
rescue
rescue
=>
e
# TODO: handle errors better, move them to a shared thing
false
false
end
end
...
@@ -83,7 +84,7 @@ module Gitlab
...
@@ -83,7 +84,7 @@ module Gitlab
def
relation_from_factory
(
relation
,
relation_hash
)
def
relation_from_factory
(
relation
,
relation_hash
)
Gitlab
::
ImportExport
::
RelationFactory
.
create
(
Gitlab
::
ImportExport
::
RelationFactory
.
create
(
relation_sym:
relation
,
relation_hash:
relation_hash
.
merge
(
'project_id'
=>
project
.
id
),
members_map:
members_map
)
relation_sym:
relation
.
to_sym
,
relation_hash:
relation_hash
.
merge
(
'project_id'
=>
project
.
id
),
members_map:
members_map
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
49cdb778
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
Gitlab
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
:map
do
describe
'map members'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
...
@@ -31,7 +31,7 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
...
@@ -31,7 +31,7 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
end
end
let
(
:members_mapper
)
do
let
(
:members_mapper
)
do
Gitlab
::
ImportExport
::
MembersMapper
.
new
(
described_class
.
new
(
exported_members:
exported_members
,
user:
user
,
project_id:
project
.
id
)
exported_members:
exported_members
,
user:
user
,
project_id:
project
.
id
)
end
end
...
...
lib/gitlab/import_export/project.json
→
spec/
lib/gitlab/import_export/project.json
View file @
49cdb778
File moved
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
49cdb778
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
ProjectTreeRestorer
,
services:
true
do
describe
Gitlab
::
ImportExport
::
ProjectTreeRestorer
,
services:
true
do
describe
:restore
do
describe
'restore project tree'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let
(
:project_tree_restorer
)
{
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
"lib/gitlab/import_export/"
,
user:
user
,
project_path:
'project'
,
namespace_id:
namespace
.
id
)
}
let
(
:project_tree_restorer
)
{
described_class
.
new
(
path:
Rails
.
root
.
join
(
"spec/lib/gitlab/import_export/"
)
,
user:
user
,
project_path:
'project'
,
namespace_id:
namespace
.
id
)
}
context
'JSON'
do
context
'JSON'
do
let
(
:restored_project_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