aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2017-03-21 17:31:31 +0000
committerGitHub2017-03-21 17:31:31 +0000
commit4117d198ccff6b220ca3e26882f1f3904130b984 (patch)
tree86a9e08a44b57912588b939fc2388bb9a16b4da2 /Library/Homebrew/cmd
parent7095b9b3c7ca8584a4e7528aa62f0ae87e3afdc0 (diff)
parentf59eb358c29c5f40601a99e3f1bf7e8e891f10ba (diff)
downloadbrew-4117d198ccff6b220ca3e26882f1f3904130b984.tar.bz2
Merge pull request #1732 from zmwangx/hint-migrations
Hint at new location of migrated formulae
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/info.rb13
-rw-r--r--Library/Homebrew/cmd/install.rb7
-rw-r--r--Library/Homebrew/cmd/log.rb28
-rw-r--r--Library/Homebrew/cmd/search.rb9
4 files changed, 36 insertions, 21 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index b7de0005c..7e1815556 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -16,7 +16,7 @@
#: See the docs for examples of using the JSON output:
#: <http://docs.brew.sh/Querying-Brew.html>
-require "blacklist"
+require "missing_formula"
require "caveats"
require "options"
require "formula"
@@ -54,10 +54,13 @@ module Homebrew
else
info_formula Formulary.find_with_priority(f)
end
- rescue FormulaUnavailableError
- # No formula with this name, try a blacklist lookup
- raise unless (blacklist = blacklisted?(f))
- puts blacklist
+ rescue FormulaUnavailableError => e
+ # No formula with this name, try a missing formula lookup
+ if (reason = Homebrew::MissingFormula.reason(f))
+ ofail "#{e.message}\n#{reason}"
+ else
+ ofail e.message
+ end
end
end
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index c825e2796..bd7897171 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -55,7 +55,7 @@
#: If `--git` is passed, Homebrew will create a Git repository, useful for
#: creating patches to the software.
-require "blacklist"
+require "missing_formula"
require "diagnostic"
require "cmd/search"
require "formula_installer"
@@ -206,12 +206,13 @@ module Homebrew
# formula was found, but there's a problem with its implementation).
ofail e.message
rescue FormulaUnavailableError => e
- if (blacklist = blacklisted?(e.name))
- ofail "#{e.message}\n#{blacklist}"
+ if (reason = Homebrew::MissingFormula.reason(e.name))
+ ofail "#{e.message}\n#{reason}"
elsif e.name == "updog"
ofail "What's updog?"
else
ofail e.message
+
query = query_regexp(e.name)
ohai "Searching for similarly named formulae..."
diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb
index 22a3ee11d..9323c762d 100644
--- a/Library/Homebrew/cmd/log.rb
+++ b/Library/Homebrew/cmd/log.rb
@@ -9,20 +9,32 @@ module Homebrew
def log
if ARGV.named.empty?
- cd HOMEBREW_REPOSITORY
- git_log
+ git_log HOMEBREW_REPOSITORY
else
path = Formulary.path(ARGV.named.first)
- cd path.dirname # supports taps
- git_log path
+ tap = Tap.from_path(path)
+ git_log path.dirname, path, tap
end
end
- def git_log(path = nil)
- if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.git/shallow"
+ def git_log(cd_dir, path = nil, tap = nil)
+ cd cd_dir
+ repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
+ if tap
+ name = tap.to_s
+ git_cd = "$(brew --repo #{tap})"
+ elsif cd_dir == HOMEBREW_REPOSITORY
+ name = "Homebrew/brew"
+ git_cd = "$(brew --repo)"
+ else
+ name, git_cd = cd_dir
+ end
+
+ if File.exist? "#{repo}/.git/shallow"
opoo <<-EOS.undent
- The git repository is a shallow clone therefore the filtering may be incorrect.
- Use `git fetch --unshallow` to get the full repository.
+ #{name} is a shallow clone so only partial output will be shown.
+ To get a full clone run:
+ git -C "#{git_cd}" fetch --unshallow
EOS
end
args = ARGV.options_only
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index e834a00b5..db5898872 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -14,7 +14,7 @@
#: Search for <text> in the given package manager's list.
require "formula"
-require "blacklist"
+require "missing_formula"
require "utils"
require "thread"
require "official_taps"
@@ -67,13 +67,12 @@ module Homebrew
if $stdout.tty?
count = local_results.length + tap_results.length
- if msg = blacklisted?(query)
+ if reason = Homebrew::MissingFormula.reason(query)
if count > 0
puts
- puts "If you meant #{query.inspect} precisely:"
- puts
+ puts "If you meant #{query.inspect} specifically:"
end
- puts msg
+ puts reason
elsif count.zero?
puts "No formula found for #{query.inspect}."
begin