2016-06-22 15:30:34 +05:30
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class RepoRestorer
|
|
|
|
include Gitlab::ImportExport::CommandLineUtil
|
2017-08-17 22:00:37 +05:30
|
|
|
include Gitlab::ShellAdapter
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
def initialize(project:, shared:, path_to_bundle:)
|
2016-06-22 15:30:34 +05:30
|
|
|
@project = project
|
|
|
|
@path_to_bundle = path_to_bundle
|
|
|
|
@shared = shared
|
|
|
|
end
|
|
|
|
|
|
|
|
def restore
|
2016-08-24 12:49:21 +05:30
|
|
|
return true unless File.exist?(@path_to_bundle)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
gitlab_shell.import_repository(@project.repository_storage_path, @project.disk_path, @path_to_bundle)
|
2016-06-22 15:30:34 +05:30
|
|
|
rescue => e
|
|
|
|
@shared.error(e)
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|