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

25 lines
528 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +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