aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/download_strategy.rb
diff options
context:
space:
mode:
authorJack Nagel2013-12-03 21:13:02 -0600
committerJack Nagel2013-12-03 21:13:02 -0600
commit9f2d4f7f8234765e48c839ee835a9a27de0e1b7a (patch)
tree89933c0d130163b3d51fd721b099e1f5c4d8ca5b /Library/Homebrew/download_strategy.rb
parentce03469916986421683601637e5b0687bfd650a3 (diff)
downloadhomebrew-9f2d4f7f8234765e48c839ee835a9a27de0e1b7a.tar.bz2
SubversionDownloadStrategy: handle changed repository URL
Fixes #22159.
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
-rw-r--r--Library/Homebrew/download_strategy.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index ce2185d6a..22b0909d5 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