class RepositoryMerger

Constants

Branch
Commit
Tag

Attributes

configuration[R]

Public Class Methods

new(configuration) click to toggle source
# File lib/repository_merger.rb, line 10
def initialize(configuration)
  @configuration = configuration
end

Public Instance Methods

import_all_tags(tag_name_conversion:) click to toggle source
# File lib/repository_merger.rb, line 38
def import_all_tags(tag_name_conversion:)
  all_tags = configuration.original_repos.flat_map(&:tags)
  import_tags(all_tags, tag_name_conversion: tag_name_conversion)
end
import_tags(tags, tag_name_conversion:) click to toggle source
# File lib/repository_merger.rb, line 43
def import_tags(tags, tag_name_conversion:)
  tag_importer = TagImporter.new(tags, configuration: configuration, tag_name_conversion: tag_name_conversion)
  tag_importer.run
end
merge_commit_history_of(references, commit_message_conversion: nil, progress_title: nil) click to toggle source
# File lib/repository_merger.rb, line 27
def merge_commit_history_of(references, commit_message_conversion: nil, progress_title: nil)
  commit_history_merger = CommitHistoryMerger.new(
    references,
    configuration: configuration,
    commit_message_conversion: commit_message_conversion,
    progress_title: progress_title
  )

  commit_history_merger.run
end
merge_commit_history_of_branches_named(original_branch_name, commit_message_conversion: nil, progress_title: nil) click to toggle source
# File lib/repository_merger.rb, line 14
def merge_commit_history_of_branches_named(original_branch_name, commit_message_conversion: nil, progress_title: nil)
  original_branches = configuration.original_repos.map { |repo| repo.branch_for(original_branch_name) }.compact

  monorepo_head_commit = merge_commit_history_of(
    original_branches,
    commit_message_conversion: commit_message_conversion,
    progress_title: progress_title
  )

  monorepo_branch_name = original_branches.first.local_name
  configuration.monorepo.create_or_update_branch(monorepo_branch_name, commit_id: monorepo_head_commit.id)
end