Class: Repositories::ReplicateService

Inherits:
BaseService show all
Defined in:
app/services/repositories/replicate_service.rb

Constant Summary collapse

Error =
Class.new(StandardError)

Constants inherited from BaseService

BaseService::UnauthorizedError

Instance Attribute Summary

Attributes inherited from BaseService

#repository

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#ignore_git_errors, #initialize, #move_error, #repo_exists?

Methods included from Gitlab::ShellAdapter

#gitlab_shell

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

This class inherits a constructor from Repositories::BaseService

Instance Method Details

#execute(new_repository, type, partition_hint: "") ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/repositories/replicate_service.rb', line 7

def execute(new_repository, type, partition_hint: "")
  new_repository.replicate(repository, partition_hint: partition_hint)

  new_checksum = new_repository.checksum
  checksum = repository.checksum

  return if new_checksum == checksum

  raise Error, format(s_(
    'ReplicateService|Failed to verify %{type} repository checksum from %{old} to %{new}'
  ), type: type, old: checksum, new: new_checksum)
rescue StandardError => e
  new_repository.remove

  raise e
end