CodeTriage
CodeTriage copied to clipboard
Ability to merge repos
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.
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.