Welcome to mirror list, hosted at ThFree Co, Russian Federation.

remote_service.rb « gitaly_client « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9218f6cfd6887832f7c5f2f307d350a94c40b554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Gitlab
  module GitalyClient
    class RemoteService
      def initialize(repository)
        @repository = repository
        @gitaly_repo = repository.gitaly_repository
        @storage = repository.storage
      end

      def add_remote(name, url, mirror_refmap)
        request = Gitaly::AddRemoteRequest.new(
          repository: @gitaly_repo, name: name, url: url,
          mirror_refmap: mirror_refmap.to_s
        )

        GitalyClient.call(@storage, :remote_service, :add_remote, request)
      end

      def remove_remote(name)
        request = Gitaly::RemoveRemoteRequest.new(repository: @gitaly_repo, name: name)

        response = GitalyClient.call(@storage, :remote_service, :remove_remote, request)

        response.result
      end
    end
  end
end