SubversionDownloadStrategy: handle corrupt checkouts
This commit is contained in:
parent
5468733e63
commit
da2efa46aa
@ -311,9 +311,19 @@ class SubversionDownloadStrategy < AbstractDownloadStrategy
|
|||||||
@co
|
@co
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def repo_valid?
|
||||||
|
@co.join(".svn").directory?
|
||||||
|
end
|
||||||
|
|
||||||
def fetch
|
def fetch
|
||||||
@url.sub!(/^svn\+/, '') if @url =~ %r[^svn\+http://]
|
@url.sub!(/^svn\+/, '') if @url =~ %r[^svn\+http://]
|
||||||
ohai "Checking out #{@url}"
|
ohai "Checking out #{@url}"
|
||||||
|
|
||||||
|
if @co.exist? and not repo_valid?
|
||||||
|
puts "Removing invalid SVN repo from cache"
|
||||||
|
@co.rmtree
|
||||||
|
end
|
||||||
|
|
||||||
if @spec == :revision
|
if @spec == :revision
|
||||||
fetch_repo @co, @url, @ref
|
fetch_repo @co, @url, @ref
|
||||||
elsif @spec == :revisions
|
elsif @spec == :revisions
|
||||||
@ -350,11 +360,11 @@ class SubversionDownloadStrategy < AbstractDownloadStrategy
|
|||||||
# Use "svn up" when the repository already exists locally.
|
# Use "svn up" when the repository already exists locally.
|
||||||
# This saves on bandwidth and will have a similar effect to verifying the
|
# This saves on bandwidth and will have a similar effect to verifying the
|
||||||
# cache as it will make any changes to get the right revision.
|
# cache as it will make any changes to get the right revision.
|
||||||
svncommand = target.exist? ? 'up' : 'checkout'
|
svncommand = target.directory? ? 'up' : 'checkout'
|
||||||
args = [@@svn, svncommand]
|
args = [@@svn, svncommand]
|
||||||
# SVN shipped with XCode 3.1.4 can't force a checkout.
|
# SVN shipped with XCode 3.1.4 can't force a checkout.
|
||||||
args << '--force' unless MacOS.version == :leopard and @@svn == '/usr/bin/svn'
|
args << '--force' unless MacOS.version == :leopard and @@svn == '/usr/bin/svn'
|
||||||
args << url if !target.exist?
|
args << url unless target.directory?
|
||||||
args << target
|
args << target
|
||||||
args << '-r' << revision if revision
|
args << '-r' << revision if revision
|
||||||
args << '--ignore-externals' if ignore_externals
|
args << '--ignore-externals' if ignore_externals
|
||||||
@ -386,9 +396,9 @@ class UnsafeSubversionDownloadStrategy < SubversionDownloadStrategy
|
|||||||
# Use "svn up" when the repository already exists locally.
|
# Use "svn up" when the repository already exists locally.
|
||||||
# This saves on bandwidth and will have a similar effect to verifying the
|
# This saves on bandwidth and will have a similar effect to verifying the
|
||||||
# cache as it will make any changes to get the right revision.
|
# cache as it will make any changes to get the right revision.
|
||||||
svncommand = target.exist? ? 'up' : 'checkout'
|
svncommand = target.directory? ? 'up' : 'checkout'
|
||||||
args = [@@svn, svncommand, '--non-interactive', '--trust-server-cert', '--force']
|
args = [@@svn, svncommand, '--non-interactive', '--trust-server-cert', '--force']
|
||||||
args << url if !target.exist?
|
args << url unless target.directory?
|
||||||
args << target
|
args << target
|
||||||
args << '-r' << revision if revision
|
args << '-r' << revision if revision
|
||||||
args << '--ignore-externals' if ignore_externals
|
args << '--ignore-externals' if ignore_externals
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user