From fa5b633650953ed1378edf6f5e82d0c944a58bcf Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 3 Dec 2013 21:13:02 -0600 Subject: [PATCH] SubversionDownloadStrategy: handle changed repository URL Fixes Homebrew/homebrew#22159. --- Library/Homebrew/download_strategy.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index ce2185d6a7..22b0909d5f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -365,10 +365,16 @@ class SubversionDownloadStrategy < VCSDownloadStrategy @clone.join(".svn").directory? end + def repo_url + `svn info '#{@clone}' 2>/dev/null`.strip[/^URL: (.+)$/, 1] + end + def fetch @url = @url.sub(/^svn\+/, '') if @url =~ %r[^svn\+http://] ohai "Checking out #{@url}" + clear_cache unless @url.chomp("/") == repo_url or quiet_system 'svn', 'switch', @url, @clone + if @clone.exist? and not repo_valid? puts "Removing invalid SVN repo from cache" clear_cache