Class: Gerrit::Command::Checkout

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

Overview

Check out a patchset locally.

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
14
15
16
# File 'lib/gerrit/command/checkout.rb', line 4

def execute
  refspec = change_refspec

  ui.spinner('Fetching patchset...') do
    result = spawn(%W[git fetch #{repo.remote_url} #{refspec}])
    if result.success?
      spawn(%w[git checkout FETCH_HEAD])
    end
  end

  ui.newline
  ui.success "You have checked out #{refspec}"
end