Sha256: c75df702715e92cf1e77feab479d8f5e83c111ec28a77f44356c71c545a547db

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'rim/module_helper'

module RIM

class InfoModuleHelper < ModuleHelper

  attr_accessor :target_rev
  attr_accessor :current_commit_exists
  attr_accessor :current_sha1
  attr_accessor :upstream_revs
  attr_accessor :upstream_non_fast_forward

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

  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.commit_exists?(current_sha1)
        @current_commit_exists = true
      end

      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

end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
esr-rim-1.4.8 lib/rim/info_module_helper.rb
esr-rim-1.4.7 lib/rim/info_module_helper.rb