aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-09-25 10:11:13 -0400
committerMax Howell2012-09-25 11:31:56 -0400
commitd1be193cfeceec37f64d4e3a7bd45a5e49a941a8 (patch)
tree017849bda4d548aecd1aa23e0b3e208b9faef149 /Library
parenta217b03952fca6df22ecc62523d9c85883aef856 (diff)
downloadbrew-d1be193cfeceec37f64d4e3a7bd45a5e49a941a8.tar.bz2
MercurialDownloadStrategy can find hg again
Was broken after superenv PATH modification. Fixes Homebrew/homebrew#15078.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 68a91d0a4..99897ff84 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -458,19 +458,27 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
def cached_location; @clone; end
+ def hgpath
+ @path ||= if which "hg"
+ 'hg'
+ else
+ "#{HOMEBREW_PREFIX}/bin/hg"
+ end
+ end
+
def fetch
- raise "You must install Mercurial: brew install mercurial" unless which "hg"
+ raise "You must: brew install hg" unless File.file?(hgpath)
ohai "Cloning #{@url}"
unless @clone.exist?
url=@url.sub(%r[^hg://], '')
- safe_system 'hg', 'clone', url, @clone
+ safe_system hgpath, 'clone', url, @clone
else
puts "Updating #{@clone}"
Dir.chdir(@clone) do
- safe_system 'hg', 'pull'
- safe_system 'hg', 'update'
+ safe_system hgpath, 'pull'
+ safe_system hgpath, 'update'
end
end
end
@@ -480,9 +488,9 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
Dir.chdir @clone do
if @spec and @ref
ohai "Checking out #{@spec} #{@ref}"
- safe_system 'hg', 'archive', '--subrepos', '-y', '-r', @ref, '-t', 'files', dst
+ safe_system hgpath, 'archive', '--subrepos', '-y', '-r', @ref, '-t', 'files', dst
else
- safe_system 'hg', 'archive', '--subrepos', '-y', '-t', 'files', dst
+ safe_system hgpath, 'archive', '--subrepos', '-y', '-t', 'files', dst
end
end
end