migrator: skip check for same taps if --force
This commit is contained in:
parent
fe830e4099
commit
896848dd87
@ -28,23 +28,19 @@ class Migrator
|
|||||||
|
|
||||||
class MigratorDifferentTapsError < RuntimeError
|
class MigratorDifferentTapsError < RuntimeError
|
||||||
def initialize(formula, tap)
|
def initialize(formula, tap)
|
||||||
if tap.nil?
|
msg = if tap == "Homebrew/homebrew"
|
||||||
super <<-EOS.undent
|
"Please try to use #{formula.oldname} to refer the formula.\n"
|
||||||
#{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} wasn't installed from taps or core formulae
|
elsif tap
|
||||||
|
|
||||||
You can try `brew migrate --force #{formula.oldname}`.
|
|
||||||
EOS
|
|
||||||
else
|
|
||||||
user, repo = tap.split("/")
|
user, repo = tap.split("/")
|
||||||
repo.sub!("homebrew-", "")
|
repo.sub!("homebrew-", "")
|
||||||
name = "fully-qualified #{user}/#{repo}/#{formula.oldname}"
|
"Please try to use fully-qualified #{user}/#{repo}/#{formula.oldname} to refer the formula.\n"
|
||||||
name = formula.oldname if tap == "Homebrew/homebrew"
|
|
||||||
super <<-EOS.undent
|
|
||||||
#{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap}
|
|
||||||
|
|
||||||
Please try to use #{name} to refer the formula
|
|
||||||
EOS
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
super <<-EOS.undent
|
||||||
|
#{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap ? tap : "path or url"}.
|
||||||
|
|
||||||
|
#{msg}To force migrate use `brew migrate --force #{formula.oldname}`.
|
||||||
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -68,7 +64,10 @@ class Migrator
|
|||||||
|
|
||||||
@old_tabs = oldpath.subdirs.each.map { |d| Tab.for_keg(Keg.new(d)) }
|
@old_tabs = oldpath.subdirs.each.map { |d| Tab.for_keg(Keg.new(d)) }
|
||||||
@old_tap = old_tabs.first.tap
|
@old_tap = old_tabs.first.tap
|
||||||
raise MigratorDifferentTapsError.new(formula, old_tap) unless from_same_taps?
|
|
||||||
|
if !ARGV.force? && !from_same_taps?
|
||||||
|
raise MigratorDifferentTapsError.new(formula, old_tap)
|
||||||
|
end
|
||||||
|
|
||||||
@newpath = HOMEBREW_CELLAR/formula.name
|
@newpath = HOMEBREW_CELLAR/formula.name
|
||||||
|
|
||||||
@ -93,9 +92,7 @@ class Migrator
|
|||||||
end
|
end
|
||||||
|
|
||||||
def from_same_taps?
|
def from_same_taps?
|
||||||
if old_tap == nil && formula.core_formula? && ARGV.force?
|
if formula.tap == old_tap
|
||||||
true
|
|
||||||
elsif formula.tap == old_tap
|
|
||||||
true
|
true
|
||||||
# Homebrew didn't use to update tabs while performing tap-migrations,
|
# Homebrew didn't use to update tabs while performing tap-migrations,
|
||||||
# so there can be INSTALL_RECEIPT's containing wrong information about
|
# so there can be INSTALL_RECEIPT's containing wrong information about
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user