2018-12-23 12:14:25 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class RepoRestorer
|
|
|
|
include Gitlab::ImportExport::CommandLineUtil
|
|
|
|
|
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
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
@project.repository.create_from_bundle(@path_to_bundle)
|
2016-06-22 15:30:34 +05:30
|
|
|
rescue => e
|
|
|
|
@shared.error(e)
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|