Add --cache support to hg and bzr.
This commit is contained in:
parent
eb30a8555b
commit
f08431b5a1
@ -253,6 +253,13 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
class MercurialDownloadStrategy <AbstractDownloadStrategy
|
class MercurialDownloadStrategy <AbstractDownloadStrategy
|
||||||
|
def initialize url, name, version, specs
|
||||||
|
super
|
||||||
|
@clone=HOMEBREW_CACHE+@unique_token
|
||||||
|
end
|
||||||
|
|
||||||
|
def cached_location; @clone; end
|
||||||
|
|
||||||
def fetch
|
def fetch
|
||||||
raise "You must install mercurial, there are two options:\n\n"+
|
raise "You must install mercurial, there are two options:\n\n"+
|
||||||
" brew install pip && pip install mercurial\n"+
|
" brew install pip && pip install mercurial\n"+
|
||||||
@ -261,11 +268,9 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
|
|||||||
unless system "/usr/bin/which hg"
|
unless system "/usr/bin/which hg"
|
||||||
|
|
||||||
ohai "Cloning #{@url}"
|
ohai "Cloning #{@url}"
|
||||||
@clone=HOMEBREW_CACHE+@unique_token
|
|
||||||
|
|
||||||
url=@url.sub(%r[^hg://], '')
|
|
||||||
|
|
||||||
unless @clone.exist?
|
unless @clone.exist?
|
||||||
|
url=@url.sub(%r[^hg://], '')
|
||||||
safe_system 'hg', 'clone', url, @clone
|
safe_system 'hg', 'clone', url, @clone
|
||||||
else
|
else
|
||||||
puts "Updating #{@clone}"
|
puts "Updating #{@clone}"
|
||||||
@ -289,16 +294,20 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class BazaarDownloadStrategy <AbstractDownloadStrategy
|
class BazaarDownloadStrategy <AbstractDownloadStrategy
|
||||||
|
def initialize url, name, version, specs
|
||||||
|
super
|
||||||
|
@clone=HOMEBREW_CACHE+@unique_token
|
||||||
|
end
|
||||||
|
|
||||||
|
def cached_location; @clone; end
|
||||||
|
|
||||||
def fetch
|
def fetch
|
||||||
raise "You must install bazaar first" \
|
raise "You must install bazaar first" \
|
||||||
unless system "/usr/bin/which bzr"
|
unless system "/usr/bin/which bzr"
|
||||||
|
|
||||||
ohai "Cloning #{@url}"
|
ohai "Cloning #{@url}"
|
||||||
@clone=HOMEBREW_CACHE+@unique_token
|
|
||||||
|
|
||||||
url=@url.sub(%r[^bzr://], '')
|
|
||||||
|
|
||||||
unless @clone.exist?
|
unless @clone.exist?
|
||||||
|
url=@url.sub(%r[^bzr://], '')
|
||||||
# 'lightweight' means history-less
|
# 'lightweight' means history-less
|
||||||
safe_system 'bzr', 'checkout', '--lightweight', url, @clone
|
safe_system 'bzr', 'checkout', '--lightweight', url, @clone
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user