Library/Homebrew/migrator.rb
def move_to_new_directory
    return unless old_cellar.exist?

    if new_cellar.exist?
      conflicted = false
      old_cellar.each_child do |c|
        next unless (new_cellar/c.basename).exist?

        begin
          FileUtils.rm_rf c
        rescue Errno::EACCES
          conflicted = true
          onoe "#{new_cellar/c.basename} already exists."
        end
      end

      if conflicted
        odie "Remove #{new_cellar} manually and run brew migrate #{oldname}."
      end
    end

    oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}"
    if new_cellar.exist?
      FileUtils.mv(old_cellar.children, new_cellar)
    else
      FileUtils.mv(old_cellar, new_cellar)
    end
  end
# move everything from Cellar/oldname to Cellar/newname
move everything from Cellar/oldname to Cellar/newname
move everything from Cellar / oldname to Cellar / newname
def move_to_new_directory
    return unless old_cellar.exist?
    if new_cellar.exist?
      conflicted = false
      old_cellar.each_child do |c|
        next unless (new_cellar/c.basename).exist?
        begin
          FileUtils.rm_rf c
        rescue Errno::EACCES
          conflicted = true
          onoe "#{new_cellar/c.basename} already exists."
        end
      end
      if conflicted
        odie "Remove #{new_cellar} manually and run brew migrate #{oldname}."
      end
    end
    oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}"
    if new_cellar.exist?
      FileUtils.mv(old_cellar.children, new_cellar)
    else
      FileUtils.mv(old_cellar, new_cellar)
    end
  end
def move_to_new_directory return unless old_cellar . exist? if new_cellar . exist? conflicted = false old_cellar . each_child do | c | next unless ( new_cellar / c . basename ) . exist? begin FileUtils . rm_rf c rescue Errno :: EACCES conflicted = true onoe "#{new_cellar/c.basename} already exists." end end if conflicted odie "Remove #{new_cellar} manually and run brew migrate #{oldname}." end end oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}" if new_cellar . exist? FileUtils . mv ( old_cellar . children , new_cellar ) else FileUtils . mv ( old_cellar , new_cellar ) end end
move everything from Cellar/oldname to Cellar/newname
move everything from Cellar / oldname to Cellar / newname