debian-mirror-gitlab/lib/gitlab/import_export/repo_restorer.rb

24 lines
532 B
Ruby
Raw Normal View History

2016-06-22 15:30:34 +05:30
module Gitlab
module ImportExport
class RepoRestorer
include Gitlab::ImportExport::CommandLineUtil
2019-01-03 12:48:30 +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
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