From ef02031d7cd1ef048c53cf940b208a6070451b8d Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sat, 17 Oct 2009 14:35:24 +0200 Subject: [PATCH] Fix Homebrew/homebrew#52: Add ability to checkout a branch or tag. GitDownloadStrategy and MercurialDownloadStrategy now can be used like this: head 'git://server/repo.git', :branch => 'stable' head 'hg://server/repo/', :tag => '1.0.4' --- Library/Homebrew/download_strategy.rb | 29 ++++++++++++++++++++++++--- Library/Homebrew/formula.rb | 14 ++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 3b9a9dd492..fc5cdfef0a 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -22,8 +22,15 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # class AbstractDownloadStrategy - def initialize url, name, version + def initialize url, name, version, specs @url=url + case specs + when Hash + @spec = specs.keys.first # only use first spec + @ref = specs.values.first + else + spec = nil + end @unique_token="#{name}-#{version}" unless name.to_s.empty? or name == '__UNKNOWN__' end end @@ -131,8 +138,17 @@ class GitDownloadStrategy