gitlab-org--gitlab-foss/lib/gitlab/import_export/repo_restorer.rb

24 lines
532 B
Ruby
Raw Normal View History

2016-04-15 16:14:28 +00:00
module Gitlab
module ImportExport
class RepoRestorer
include Gitlab::ImportExport::CommandLineUtil
include Gitlab::ShellAdapter
2016-04-15 16:14:28 +00:00
2016-07-18 09:02:07 +00:00
def initialize(project:, shared:, path_to_bundle:)
2016-04-15 16:14:28 +00:00
@project = project
@path_to_bundle = path_to_bundle
@shared = shared
2016-04-15 16:14:28 +00:00
end
def restore
2016-07-18 09:02:07 +00:00
return true unless File.exist?(@path_to_bundle)
2016-04-15 16:14:28 +00:00
@project.repository.create_from_bundle(@path_to_bundle)
rescue => e
@shared.error(e)
2016-05-05 11:19:41 +00:00
false
2016-04-15 16:14:28 +00:00
end
end
end
end