Class: RIM::InfoModuleHelper

Inherits:
ModuleHelper show all
Defined in:
lib/rim/info_module_helper.rb

Constant Summary

Constants inherited from Processor

Processor::GerritServer, Processor::MaxThreads

Instance Attribute Summary collapse

Attributes inherited from ModuleHelper

#module_info

Instance Method Summary collapse

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, module_info, logger) ⇒ InfoModuleHelper

Returns a new instance of InfoModuleHelper.



12
13
14
# File 'lib/rim/info_module_helper.rb', line 12

def initialize(workspace_root, module_info, logger)
  super(workspace_root, module_info, logger)
end

Instance Attribute Details

#current_sha1Object

Returns the value of attribute current_sha1.



8
9
10
# File 'lib/rim/info_module_helper.rb', line 8

def current_sha1
  @current_sha1
end

#target_revObject

Returns the value of attribute target_rev.



7
8
9
# File 'lib/rim/info_module_helper.rb', line 7

def target_rev
  @target_rev
end

#upstream_non_fast_forwardObject

Returns the value of attribute upstream_non_fast_forward.



10
11
12
# File 'lib/rim/info_module_helper.rb', line 10

def upstream_non_fast_forward
  @upstream_non_fast_forward
end

#upstream_revsObject

Returns the value of attribute upstream_revs.



9
10
11
# File 'lib/rim/info_module_helper.rb', line 9

def upstream_revs
  @upstream_revs
end

Instance Method Details

#gather_infoObject



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

def gather_info
  fetch_module
  rim_info = RimInfo.from_dir(File.join(@ws_root, @module_info.local_path))
  @target_rev = rim_info.target_revision
  @current_sha1 = rim_info.revision_sha1
  RIM::git_session(git_path) do |s|
    if s.has_remote_branch?(target_rev)
      # repository is mirrored so branches are "local"
      if s.is_ancestor?(current_sha1, target_rev)
        @upstream_revs = s.execute("git rev-list --oneline #{target_rev} \"^#{current_sha1}\"").split("\n")
      else
        @upstream_non_fast_forward = true
      end
    end
  end
end