2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module Gitlab
|
|
|
|
module Git
|
|
|
|
class RemoteMirror
|
2018-12-13 13:39:08 +05:30
|
|
|
include Gitlab::Git::WrapsGitalyErrors
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
attr_reader :repository, :ref_name, :only_branches_matching, :ssh_key, :known_hosts, :keep_divergent_refs
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
def initialize(repository, ref_name, only_branches_matching: [], ssh_key: nil, known_hosts: nil, keep_divergent_refs: false)
|
2018-03-17 18:26:18 +05:30
|
|
|
@repository = repository
|
|
|
|
@ref_name = ref_name
|
2019-02-15 15:39:39 +05:30
|
|
|
@only_branches_matching = only_branches_matching
|
|
|
|
@ssh_key = ssh_key
|
|
|
|
@known_hosts = known_hosts
|
2020-04-22 19:07:51 +05:30
|
|
|
@keep_divergent_refs = keep_divergent_refs
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
def update
|
2018-12-13 13:39:08 +05:30
|
|
|
wrapped_gitaly_errors do
|
2019-02-15 15:39:39 +05:30
|
|
|
repository.gitaly_remote_client.update_remote_mirror(
|
|
|
|
ref_name,
|
|
|
|
only_branches_matching,
|
|
|
|
ssh_key: ssh_key,
|
2020-04-22 19:07:51 +05:30
|
|
|
known_hosts: known_hosts,
|
|
|
|
keep_divergent_refs: keep_divergent_refs
|
2019-02-15 15:39:39 +05:30
|
|
|
)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|