module SRC

Constants

BRANCHES

Public Class Methods

branches() click to toggle source
# File lib/src.rb, line 52
def self.branches
  @branches ||= BRANCHES.map do |k, v|
    if v
      sc_branch = SRC::Branch.new(k) if v
      sc_branch.latest if sc_branch.unmerged?
    else
      SRC::Git::Branch.new(k)
    end
  end.compact.uniq { |branch| branch.name }
end
check() click to toggle source
# File lib/src.rb, line 27
def self.check
  SRC::Git.fetch

  report = []

  branches.each_with_index do |branch, i|

    branches[(i + 1)..-1].each do |superset|
      unless branch.subset_of?(superset)
        report << "#{branch} is ahead of #{superset}"
      end
    end

    unless branch.remote_up_to_date?
      report << "#{branch} is not up to date with its remote"
    end
  end

  if report.empty?
    puts 'No merges needed.'
  else
    puts report.join("\n")
  end
end