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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
5777ad9a
Commit
5777ad9a
authored
May 16, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding versioning to export
parent
f386d7a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
+43
-3
app/services/projects/import_export/export_service.rb
app/services/projects/import_export/export_service.rb
+8
-3
lib/gitlab/import_export.rb
lib/gitlab/import_export.rb
+6
-0
lib/gitlab/import_export/version_saver.rb
lib/gitlab/import_export/version_saver.rb
+29
-0
No files found.
app/services/projects/import_export/export_service.rb
View file @
5777ad9a
...
...
@@ -4,12 +4,16 @@ module Projects
def
execute
(
options
=
{})
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
File
.
join
(
project
.
path_with_namespace
,
'work'
))
save_all
if
[
save_project_tree
,
bundle_repo
,
bundle_wiki_repo
].
all?
notify_worker
if
@shared
.
errors
.
any?
save_all
if
[
save_
version
,
save_
project_tree
,
bundle_repo
,
bundle_wiki_repo
].
all?
cleanup_and_
notify_worker
if
@shared
.
errors
.
any?
end
private
def
save_version
Gitlab
::
ImportExport
::
VersionSaver
.
save
(
shared:
@shared
)
end
def
save_project_tree
Gitlab
::
ImportExport
::
ProjectTreeSaver
.
new
(
project:
project
,
shared:
@shared
).
save
end
...
...
@@ -26,7 +30,8 @@ module Projects
Gitlab
::
ImportExport
::
Saver
.
save
(
shared:
@shared
)
end
def
notify_worker
def
cleanup_and_notify_worker
FileUtils
.
rm_rf
(
@shared
.
export_path
)
raise
Gitlab
::
ImportExport
::
Error
.
new
(
@shared
.
errors
.
join
(
', '
))
end
end
...
...
lib/gitlab/import_export.rb
View file @
5777ad9a
...
...
@@ -2,6 +2,8 @@ module Gitlab
module
ImportExport
extend
self
VERSION
=
'0.1.0'
def
export_path
(
relative_path
:)
File
.
join
(
storage_path
,
relative_path
)
end
...
...
@@ -17,5 +19,9 @@ module Gitlab
def
project_bundle_filename
"project.bundle"
end
def
version_filename
'VERSION'
end
end
end
lib/gitlab/import_export/version_saver.rb
0 → 100644
View file @
5777ad9a
module
Gitlab
module
ImportExport
class
VersionSaver
def
self
.
save
(
*
args
)
new
(
*
args
).
save
end
def
initialize
(
shared
:)
@shared
=
shared
end
def
save
File
.
open
(
version_file
,
'w'
)
do
|
file
|
file
.
write
(
Gitlab
::
ImportExport
.
VERSION
)
end
rescue
=>
e
@shared
.
error
(
e
.
message
)
false
end
private
def
version_file
File
.
join
(
@shared
.
export_path
,
Gitlab
::
ImportExport
.
version_filename
)
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