debian-mirror-gitlab/lib/gitlab/git/remote_mirror.rb

33 lines
969 B
Ruby
Raw Normal View History

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
2021-10-27 15:23:28 +05:30
attr_reader :repository, :remote_url, :only_branches_matching, :ssh_key, :known_hosts, :keep_divergent_refs
2019-02-15 15:39:39 +05:30
2021-10-27 15:23:28 +05:30
def initialize(repository, remote_url, only_branches_matching: [], ssh_key: nil, known_hosts: nil, keep_divergent_refs: false)
2018-03-17 18:26:18 +05:30
@repository = repository
2021-09-04 01:27:46 +05:30
@remote_url = remote_url
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(
2021-09-04 01:27:46 +05:30
remote_url,
2019-02-15 15:39:39 +05:30
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