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
9d0038f2
Commit
9d0038f2
authored
Jun 03, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
started refactoring a bunch of stuff based on feedback
parent
398f0071
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
31 deletions
+28
-31
app/services/projects/import_export/export_service.rb
app/services/projects/import_export/export_service.rb
+18
-15
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+2
-0
lib/gitlab/import_export/repo_saver.rb
lib/gitlab/import_export/repo_saver.rb
+2
-2
lib/gitlab/import_export/uploads_saver.rb
lib/gitlab/import_export/uploads_saver.rb
+0
-4
lib/gitlab/import_export/version_saver.rb
lib/gitlab/import_export/version_saver.rb
+0
-4
lib/gitlab/import_export/wiki_repo_saver.rb
lib/gitlab/import_export/wiki_repo_saver.rb
+2
-2
spec/lib/gitlab/import_export/repo_bundler_spec.rb
spec/lib/gitlab/import_export/repo_bundler_spec.rb
+2
-2
spec/lib/gitlab/import_export/wiki_repo_bundler_spec.rb
spec/lib/gitlab/import_export/wiki_repo_bundler_spec.rb
+2
-2
No files found.
app/services/projects/import_export/export_service.rb
View file @
9d0038f2
...
@@ -2,36 +2,39 @@ module Projects
...
@@ -2,36 +2,39 @@ module Projects
module
ImportExport
module
ImportExport
class
ExportService
<
BaseService
class
ExportService
<
BaseService
def
execute
(
options
=
{})
def
execute
(
_
options
=
{})
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
File
.
join
(
project
.
path_with_namespace
,
'work'
))
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
File
.
join
(
project
.
path_with_namespace
,
'work'
))
save_all
if
[
save_version
,
save_project_tree
,
save_uploads
,
bundle_repo
,
bundle_wiki_repo
].
all?
save_all
cleanup_and_notify_worker
if
@shared
.
errors
.
any?
end
end
private
private
def
save_version
def
save_all
Gitlab
::
ImportExport
::
VersionSaver
.
save
(
shared:
@shared
)
if
[
version_saver
,
project_tree_saver
,
uploads_saver
,
repo_saver
,
wiki_repo_saver
].
all?
(
&
:save
)
Gitlab
::
ImportExport
::
Saver
.
save
(
shared:
@shared
)
else
cleanup_and_notify_worker
end
end
end
def
save_project_tree
def
version_saver
Gitlab
::
ImportExport
::
ProjectTreeSaver
.
new
(
project:
project
,
shared:
@shared
).
save
Gitlab
::
ImportExport
::
VersionSaver
.
new
(
shared:
@shared
)
end
end
def
save_uploads
def
project_tree_saver
Gitlab
::
ImportExport
::
UploadsSaver
.
save
(
project:
project
,
shared:
@shared
)
Gitlab
::
ImportExport
::
ProjectTreeSaver
.
new
(
project:
project
,
shared:
@shared
)
end
end
def
bundle_repo
def
uploads_saver
Gitlab
::
ImportExport
::
RepoBundler
.
new
(
project:
project
,
shared:
@shared
).
bundle
Gitlab
::
ImportExport
::
UploadsSaver
.
new
(
project:
project
,
shared:
@shared
)
end
end
def
bundle_wiki_repo
def
repo_saver
Gitlab
::
ImportExport
::
WikiRepoBundler
.
new
(
project:
project
,
shared:
@shared
).
bundle
Gitlab
::
ImportExport
::
RepoSaver
.
new
(
project:
project
,
shared:
@shared
)
end
end
def
save_all
def
wiki_repo_saver
Gitlab
::
ImportExport
::
Saver
.
save
(
shared:
@shared
)
Gitlab
::
ImportExport
::
WikiRepoSaver
.
new
(
project:
project
,
shared:
@shared
)
end
end
def
cleanup_and_notify_worker
def
cleanup_and_notify_worker
...
...
lib/gitlab/import_export/import_export.yml
View file @
9d0038f2
...
@@ -16,6 +16,8 @@ project_tree:
...
@@ -16,6 +16,8 @@ project_tree:
-
:merge_request_diff
-
:merge_request_diff
-
ci_commits
:
-
ci_commits
:
-
:statuses
-
:statuses
-
notes
:
:author
-
:variables
-
:variables
-
:triggers
-
:triggers
-
:deploy_keys
-
:deploy_keys
...
...
lib/gitlab/import_export/repo_
bundl
er.rb
→
lib/gitlab/import_export/repo_
sav
er.rb
View file @
9d0038f2
module
Gitlab
module
Gitlab
module
ImportExport
module
ImportExport
class
Repo
Bundl
er
class
Repo
Sav
er
include
Gitlab
::
ImportExport
::
CommandLineUtil
include
Gitlab
::
ImportExport
::
CommandLineUtil
attr_reader
:full_path
attr_reader
:full_path
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
@shared
=
shared
@shared
=
shared
end
end
def
bundl
e
def
sav
e
return
false
if
@project
.
empty_repo?
return
false
if
@project
.
empty_repo?
@full_path
=
File
.
join
(
@shared
.
export_path
,
ImportExport
.
project_bundle_filename
)
@full_path
=
File
.
join
(
@shared
.
export_path
,
ImportExport
.
project_bundle_filename
)
bundle_to_disk
bundle_to_disk
...
...
lib/gitlab/import_export/uploads_saver.rb
View file @
9d0038f2
...
@@ -2,10 +2,6 @@ module Gitlab
...
@@ -2,10 +2,6 @@ module Gitlab
module
ImportExport
module
ImportExport
class
UploadsSaver
class
UploadsSaver
def
self
.
save
(
*
args
)
new
(
*
args
).
save
end
def
initialize
(
project
:,
shared
:)
def
initialize
(
project
:,
shared
:)
@project
=
project
@project
=
project
@shared
=
shared
@shared
=
shared
...
...
lib/gitlab/import_export/version_saver.rb
View file @
9d0038f2
...
@@ -2,10 +2,6 @@ module Gitlab
...
@@ -2,10 +2,6 @@ module Gitlab
module
ImportExport
module
ImportExport
class
VersionSaver
class
VersionSaver
def
self
.
save
(
*
args
)
new
(
*
args
).
save
end
def
initialize
(
shared
:)
def
initialize
(
shared
:)
@shared
=
shared
@shared
=
shared
end
end
...
...
lib/gitlab/import_export/wiki_repo_
bundl
er.rb
→
lib/gitlab/import_export/wiki_repo_
sav
er.rb
View file @
9d0038f2
module
Gitlab
module
Gitlab
module
ImportExport
module
ImportExport
class
WikiRepo
Bundler
<
RepoBundl
er
class
WikiRepo
Saver
<
RepoSav
er
def
bundl
e
def
sav
e
@wiki
=
ProjectWiki
.
new
(
@project
)
@wiki
=
ProjectWiki
.
new
(
@project
)
return
true
unless
wiki_repository_exists?
# it's okay to have no Wiki
return
true
unless
wiki_repository_exists?
# it's okay to have no Wiki
bundle_to_disk
(
File
.
join
(
@shared
.
export_path
,
project_filename
))
bundle_to_disk
(
File
.
join
(
@shared
.
export_path
,
project_filename
))
...
...
spec/lib/gitlab/import_export/repo_bundler_spec.rb
View file @
9d0038f2
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
Repo
Bundl
er
,
services:
true
do
describe
Gitlab
::
ImportExport
::
Repo
Sav
er
,
services:
true
do
describe
'bundle a project Git repo'
do
describe
'bundle a project Git repo'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
@@ -19,7 +19,7 @@ describe Gitlab::ImportExport::RepoBundler, services: true do
...
@@ -19,7 +19,7 @@ describe Gitlab::ImportExport::RepoBundler, services: true do
end
end
it
'bundles the repo successfully'
do
it
'bundles the repo successfully'
do
expect
(
bundler
.
bundl
e
).
to
be
true
expect
(
bundler
.
sav
e
).
to
be
true
end
end
end
end
end
end
spec/lib/gitlab/import_export/wiki_repo_bundler_spec.rb
View file @
9d0038f2
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
WikiRepo
Bundl
er
,
services:
true
do
describe
Gitlab
::
ImportExport
::
WikiRepo
Sav
er
,
services:
true
do
describe
'bundle a wiki Git repo'
do
describe
'bundle a wiki Git repo'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
@@ -22,7 +22,7 @@ describe Gitlab::ImportExport::WikiRepoBundler, services: true do
...
@@ -22,7 +22,7 @@ describe Gitlab::ImportExport::WikiRepoBundler, services: true do
end
end
it
'bundles the repo successfully'
do
it
'bundles the repo successfully'
do
expect
(
wiki_bundler
.
bundl
e
).
to
be
true
expect
(
wiki_bundler
.
sav
e
).
to
be
true
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