module RepositoryMerger::Reference

Public Instance Methods

mainline?(commit) click to toggle source
# File lib/repository_merger/reference.rb, line 23
def mainline?(commit)
  mainline_commit_ids.include?(commit.id)
end
mainline_commit_ids() click to toggle source
# File lib/repository_merger/reference.rb, line 27
def mainline_commit_ids
  @mainline_commit_ids ||= Set.new.tap do |mainline_commit_ids|
    commit = target_commit

    while commit
      mainline_commit_ids << commit.id
      commit = commit.parents.first
    end
  end.freeze
end
target_commit() click to toggle source
# File lib/repository_merger/reference.rb, line 10
def target_commit
  raise NotImplementedError
end
topologically_ordered_commits_from_root() click to toggle source
# File lib/repository_merger/reference.rb, line 14
def topologically_ordered_commits_from_root
  @topologically_ordered_commits_from_root ||= begin
    walker = Rugged::Walker.new(repo.rugged_repo)
    walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
    walker.push(target_commit.id)
    walker.map { |rugged_commit| Commit.new(rugged_commit, repo) }.freeze
  end
end