Class: RIM::UploadHelper

Inherits:
CommandHelper show all
Defined in:
lib/rim/upload_helper.rb

Constant Summary

Constants inherited from Processor

Processor::GerritServer, Processor::MaxThreads

Instance Method Summary collapse

Methods inherited from CommandHelper

#add_unique_module_info, #all_module_paths_from_path, #check_arguments, #check_ready, #create_module_info, #find_file_dir_in_workspace, #get_remote_branch_format, #module_from_path, #module_paths, #modules_from_manifest, #modules_from_paths

Methods included from Manifest

#parse_manifest, #read_manifest

Methods inherited from Processor

#clone_or_fetch_repository, #commit, #each_module_parallel, #get_absolute_remote_url, #get_relative_path, #local_changes?, #module_git_path, #module_tmp_git_path, #remote_path, shorten_path

Constructor Details

#initialize(workspace_root, review, logger, module_infos = nil) ⇒ UploadHelper

Returns a new instance of UploadHelper.



8
9
10
11
12
# File 'lib/rim/upload_helper.rb', line 8

def initialize(workspace_root, review, logger, module_infos = nil)
  @module_helpers = []
  @review = review
  super(workspace_root, logger, module_infos)
end

Instance Method Details

#add_module_info(module_info) ⇒ Object

called to add a module info



36
37
38
# File 'lib/rim/upload_helper.rb', line 36

def add_module_info(module_info)
  @module_helpers.push(UploadModuleHelper.new(@ws_root, module_info, @review, @logger))
end

#uploadObject

upload all module changes into corresponding remote repositories



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rim/upload_helper.rb', line 15

def upload
  # get the name of the current workspace branch
  RIM::git_session(@ws_root) do |s|
    branch = s.current_branch
    if branch.nil?
      raise RimException.new("Not on a git branch.")
    elsif !branch.start_with?("rim/")
      begin
        sha1 = s.rev_sha1(branch)
        @logger.info("Uploading modules...")
        upload_modules(get_upload_revisions(s, sha1))
      ensure
        s.execute("git checkout -B #{branch}")
      end
    else
      raise RimException.new("The current git branch '#{branch}' is a rim integration branch. Please switch to a non rim branch to proceed.")
    end
  end
end