Class: Gitlab::Git::RemoteMirror

Inherits:
Object
  • Object
show all
Includes:
WrapsGitalyErrors
Defined in:
lib/gitlab/git/remote_mirror.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from WrapsGitalyErrors

#wrapped_gitaly_errors

Constructor Details

#initialize(repository, remote_url, only_branches_matching: [], ssh_key: nil, known_hosts: nil, keep_divergent_refs: false) ⇒ RemoteMirror

Returns a new instance of RemoteMirror.



10
11
12
13
14
15
16
17
# File 'lib/gitlab/git/remote_mirror.rb', line 10

def initialize(repository, remote_url, only_branches_matching: [], ssh_key: nil, known_hosts: nil, keep_divergent_refs: false)
  @repository = repository
  @remote_url = remote_url
  @only_branches_matching = only_branches_matching
  @ssh_key = ssh_key
  @known_hosts = known_hosts
  @keep_divergent_refs = keep_divergent_refs
end

Instance Attribute Details

#keep_divergent_refsObject (readonly)

Returns the value of attribute keep_divergent_refs.



8
9
10
# File 'lib/gitlab/git/remote_mirror.rb', line 8

def keep_divergent_refs
  @keep_divergent_refs
end

#known_hostsObject (readonly)

Returns the value of attribute known_hosts.



8
9
10
# File 'lib/gitlab/git/remote_mirror.rb', line 8

def known_hosts
  @known_hosts
end

#only_branches_matchingObject (readonly)

Returns the value of attribute only_branches_matching.



8
9
10
# File 'lib/gitlab/git/remote_mirror.rb', line 8

def only_branches_matching
  @only_branches_matching
end

#remote_urlObject (readonly)

Returns the value of attribute remote_url.



8
9
10
# File 'lib/gitlab/git/remote_mirror.rb', line 8

def remote_url
  @remote_url
end

#repositoryObject (readonly)

Returns the value of attribute repository.



8
9
10
# File 'lib/gitlab/git/remote_mirror.rb', line 8

def repository
  @repository
end

#ssh_keyObject (readonly)

Returns the value of attribute ssh_key.



8
9
10
# File 'lib/gitlab/git/remote_mirror.rb', line 8

def ssh_key
  @ssh_key
end

Instance Method Details

#updateObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/git/remote_mirror.rb', line 19

def update
  wrapped_gitaly_errors do
    repository.gitaly_remote_client.update_remote_mirror(
      remote_url,
      only_branches_matching,
      ssh_key: ssh_key,
      known_hosts: known_hosts,
      keep_divergent_refs: keep_divergent_refs
    )
  end
end