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
Tatuya Kamada
gitlab-ce
Commits
51487575
Commit
51487575
authored
May 16, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added version check on import
parent
8c478874
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
lib/gitlab/import_export/import_service.rb
lib/gitlab/import_export/import_service.rb
+5
-1
lib/gitlab/import_export/version_restorer.rb
lib/gitlab/import_export/version_restorer.rb
+36
-0
lib/gitlab/import_export/version_saver.rb
lib/gitlab/import_export/version_saver.rb
+1
-1
No files found.
lib/gitlab/import_export/import_service.rb
View file @
51487575
...
...
@@ -16,7 +16,7 @@ module Gitlab
def
execute
Gitlab
::
ImportExport
::
Importer
.
import
(
archive_file:
@archive_file
,
shared:
@shared
)
if
[
restore_project_tree
,
restore_repo
,
restore_wiki_repo
].
all?
if
[
restore_
version
,
restore_
project_tree
,
restore_repo
,
restore_wiki_repo
].
all?
project_tree
.
project
else
project_tree
.
project
.
destroy
if
project_tree
.
project
...
...
@@ -26,6 +26,10 @@ module Gitlab
private
def
restore_version
Gitlab
::
ImportExport
::
VersionRestorer
.
restore
(
shared:
@shared
)
end
def
restore_project_tree
project_tree
.
restore
end
...
...
lib/gitlab/import_export/version_restorer.rb
0 → 100644
View file @
51487575
module
Gitlab
module
ImportExport
class
VersionRestorer
def
self
.
restore
(
*
args
)
new
(
*
args
).
restore
end
def
initialize
(
shared
:)
@shared
=
shared
end
def
restore
version
=
File
.
open
(
version_file
,
&
:readline
)
verify_version!
(
version
)
rescue
=>
e
@shared
.
error
(
e
)
false
end
private
def
version_file
File
.
join
(
@shared
.
export_path
,
Gitlab
::
ImportExport
.
version_filename
)
end
def
verify_version!
(
version
)
if
Gem
::
Version
.
new
(
version
)
>
Gem
::
Version
.
new
(
Gitlab
::
ImportExport
.
VERSION
)
raise
Gitlab
::
ImportExport
::
Error
(
"Import version mismatch: Required <=
#{
Gitlab
::
ImportExport
.
VERSION
}
but was
#{
version
}
"
)
else
true
end
end
end
end
end
lib/gitlab/import_export/version_saver.rb
View file @
51487575
...
...
@@ -15,7 +15,7 @@ module Gitlab
file
.
write
(
Gitlab
::
ImportExport
.
VERSION
)
end
rescue
=>
e
@shared
.
error
(
e
.
message
)
@shared
.
error
(
e
)
false
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