Library/Homebrew/migrator.rb
# Backup everything if errors occurred while migrating.
Backup everything if errors occurred while migrating.
Backup everything if errors occurred while migrating .
def backup_oldname
    unlink_oldname_opt
    unlink_oldname_cellar
    backup_oldname_cellar
    backup_old_tabs
    if pinned? && !old_pin_record.symlink?
      src_oldname = (old_pin_record.dirname/old_pin_link_record).expand_path
      old_pin_record.make_relative_symlink(src_oldname)
      new_pin_record.delete
    end
    if new_cellar.exist?
      new_cellar.subdirs.each do |d|
        newname_keg = Keg.new(d)
        newname_keg.unlink
        newname_keg.uninstall if new_cellar_existed
      end
    end
    return if old_linked_keg.nil?
    if old_linked_keg_record
      begin
        old_linked_keg.link
      rescue Keg::LinkError
        old_linked_keg.unlink
        raise
      rescue Keg::AlreadyLinkedError
        old_linked_keg.unlink
        retry
      end
    else
      old_linked_keg.optlink
    end
  end
def backup_oldname unlink_oldname_opt unlink_oldname_cellar backup_oldname_cellar backup_old_tabs if pinned? && ! old_pin_record . symlink? src_oldname = ( old_pin_record . dirname / old_pin_link_record ) . expand_path old_pin_record . make_relative_symlink ( src_oldname ) new_pin_record . delete end if new_cellar . exist? new_cellar . subdirs . each do | d | newname_keg = Keg . new ( d ) newname_keg . unlink newname_keg . uninstall if new_cellar_existed end end return if old_linked_keg . nil? if old_linked_keg_record begin old_linked_keg . link rescue Keg :: LinkError old_linked_keg . unlink raise rescue Keg :: AlreadyLinkedError old_linked_keg . unlink retry end else old_linked_keg . optlink end end
Backup everything if errors occurred while migrating.
Backup everything if errors occurred while migrating .
# The keg used to be linked and when we backup everything we restore # Cellar/oldname, the target also gets restored, so we are able to # create a keg using its old path