Class: Gerrit::Command::Setup

Inherits:
Base
  • Object
show all
Defined in:
lib/gerrit/command/setup.rb

Overview

Sets up the remotes for this repository to push/pull to/from Gerrit.

Instance Method Summary collapse

Methods inherited from Base

#execute_command, from_arguments, #initialize, #run

Methods included from Utils

camel_case, commit_hash?, human_time, map_in_parallel, snake_case

Constructor Details

This class inherits a constructor from Gerrit::Command::Base

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/gerrit/command/setup.rb', line 4

def execute
  remotes_to_add = config[:remotes]
  existing_remotes = repo.remotes.keys & remotes_to_add.keys

  if existing_remotes.any?
    return unless can_replace?(existing_remotes)
  end

  add_remotes(remotes_to_add)
end