CodeTriage icon indicating copy to clipboard operation
CodeTriage copied to clipboard

Ability to merge repos

Open schneems opened this issue 6 years ago • 1 comments

When a repo is renamed then subscribers need to be migrated from one repo to another For example:

old_name = "piwik/piwik"
new_name = "matomo-org/matomo"

old_repo = Repo.where(full_name: old_name).first
new_repo = Repo.where(full_name: new_name).first

raise "new repo does not exist" unless new_repo.present?
new_repo.update_from_github

old_repo.repo_subscriptions.each do |s|
  new_repo.repo_subscriptions.create!(user_id: s.user_id, email_limit: s.email_limit, write: s.write, read: s.read, write_limit: s.write_limit, read_limit: s.read_limit)
rescue => e
  puts "=" * 80
  puts s.id
  puts e
end


old_repo.repo_subscriptions.destroy_all
old_repo.doc_methods.destroy_all
old_repo.destroy

Not sure how issues subscribed transfer over.

schneems avatar Jun 10 '19 18:06 schneems

Same happens with youtube-dl Old repo: https://www.codetriage.com/rg3/youtube-dl Now redirects to new one in GitHub: https://www.codetriage.com/ytdl-org/youtube-dl

But code triage still has two repos with different helpers.

andrericardo avatar Sep 11 '19 09:09 andrericardo