mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
MercurialDownloadStrategy can find hg again
Was broken after superenv PATH modification. Fixes Homebrew/homebrew#15078.
This commit is contained in:
parent
a217b03952
commit
d1be193cfe
@ -458,19 +458,27 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
|
|||||||
|
|
||||||
def cached_location; @clone; end
|
def cached_location; @clone; end
|
||||||
|
|
||||||
|
def hgpath
|
||||||
|
@path ||= if which "hg"
|
||||||
|
'hg'
|
||||||
|
else
|
||||||
|
"#{HOMEBREW_PREFIX}/bin/hg"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def fetch
|
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}"
|
ohai "Cloning #{@url}"
|
||||||
|
|
||||||
unless @clone.exist?
|
unless @clone.exist?
|
||||||
url=@url.sub(%r[^hg://], '')
|
url=@url.sub(%r[^hg://], '')
|
||||||
safe_system 'hg', 'clone', url, @clone
|
safe_system hgpath, 'clone', url, @clone
|
||||||
else
|
else
|
||||||
puts "Updating #{@clone}"
|
puts "Updating #{@clone}"
|
||||||
Dir.chdir(@clone) do
|
Dir.chdir(@clone) do
|
||||||
safe_system 'hg', 'pull'
|
safe_system hgpath, 'pull'
|
||||||
safe_system 'hg', 'update'
|
safe_system hgpath, 'update'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -480,9 +488,9 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
|
|||||||
Dir.chdir @clone do
|
Dir.chdir @clone do
|
||||||
if @spec and @ref
|
if @spec and @ref
|
||||||
ohai "Checking out #{@spec} #{@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
|
else
|
||||||
safe_system 'hg', 'archive', '--subrepos', '-y', '-t', 'files', dst
|
safe_system hgpath, 'archive', '--subrepos', '-y', '-t', 'files', dst
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user