aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-07 14:15:32 -0700
committerAdam Vandenberg2010-06-07 14:15:45 -0700
commitf08431b5a13f7af049214ffe08fce85b8ab32ee7 (patch)
tree5041c5820a662497d908de95c5f74965855cd458 /Library
parenteb30a8555b73836d42296735798bc026590e1213 (diff)
downloadbrew-f08431b5a13f7af049214ffe08fce85b8ab32ee7.tar.bz2
Add --cache support to hg and bzr.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index f4316b9fe..aa60b3c49 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -253,6 +253,13 @@ private
end
class MercurialDownloadStrategy <AbstractDownloadStrategy
+ def initialize url, name, version, specs
+ super
+ @clone=HOMEBREW_CACHE+@unique_token
+ end
+
+ def cached_location; @clone; end
+
def fetch
raise "You must install mercurial, there are two options:\n\n"+
" brew install pip && pip install mercurial\n"+
@@ -261,11 +268,9 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
unless system "/usr/bin/which hg"
ohai "Cloning #{@url}"
- @clone=HOMEBREW_CACHE+@unique_token
-
- url=@url.sub(%r[^hg://], '')
unless @clone.exist?
+ url=@url.sub(%r[^hg://], '')
safe_system 'hg', 'clone', url, @clone
else
puts "Updating #{@clone}"
@@ -289,16 +294,20 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
end
class BazaarDownloadStrategy <AbstractDownloadStrategy
+ def initialize url, name, version, specs
+ super
+ @clone=HOMEBREW_CACHE+@unique_token
+ end
+
+ def cached_location; @clone; end
+
def fetch
raise "You must install bazaar first" \
unless system "/usr/bin/which bzr"
ohai "Cloning #{@url}"
- @clone=HOMEBREW_CACHE+@unique_token
-
- url=@url.sub(%r[^bzr://], '')
-
unless @clone.exist?
+ url=@url.sub(%r[^bzr://], '')
# 'lightweight' means history-less
safe_system 'bzr', 'checkout', '--lightweight', url, @clone
else