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
104f221b
Commit
104f221b
authored
Sep 05, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs
parent
1d57ae8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+4
-6
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 @
104f221b
...
...
@@ -72,7 +72,7 @@ module Gitlab
@saved
<<
restored_project
.
append_or_update_attribute
(
relation_key
,
relation_hash
)
# Restore the project again, extra query but let us skip holding the AR objects in memory
@restored_project
=
Project
.
find
_by_id
(
@project_id
)
@restored_project
=
Project
.
find
(
@project_id
)
end
def
default_relation_list
...
...
@@ -153,14 +153,12 @@ module Gitlab
end
def
create_relation
(
relation
,
relation_hash_list
)
relation_type
=
relation
.
to_sym
relation_array
=
[
relation_hash_list
].
flatten
.
map
do
|
relation_hash
|
Gitlab
::
ImportExport
::
RelationFactory
.
create
(
relation_sym:
relation
_type
,
relation_hash:
parsed_relation_hash
(
relation_hash
,
relation
_type
),
Gitlab
::
ImportExport
::
RelationFactory
.
create
(
relation_sym:
relation
.
to_sym
,
relation_hash:
parsed_relation_hash
(
relation_hash
,
relation
.
to_sym
),
members_mapper:
members_mapper
,
user:
@user
,
project:
restored_project
)
project:
@
restored_project
)
end
.
compact
relation_hash_list
.
is_a?
(
Array
)
?
relation_array
:
relation_array
.
first
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
104f221b
...
...
@@ -11,8 +11,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
@project
=
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
allow
(
@project
.
r
epository
).
to
receive
(
:fetch_ref
).
and_return
(
true
)
allow
(
@project
.
repository
.
raw
).
to
receive
(
:rugged_
branch_exists?
).
and_return
(
false
)
allow
_any_instance_of
(
R
epository
).
to
receive
(
:fetch_ref
).
and_return
(
true
)
allow
_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:
branch_exists?
).
and_return
(
false
)
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
)
...
...
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