mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-11-28 20:09:41 -05:00
MercurialDownloadStrategy: handle corrupt checkouts
This commit is contained in:
1 parent
45209923b5
commit
4aa6deebbd
1 file changed
+17
-5
@@ -631,18 +631,30 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
|
||||
def fetch
|
||||
ohai "Cloning #{@url}"
|
||||
|
||||
unless @clone.exist?
|
||||
url=@url.sub(%r[^hg://], '')
|
||||
safe_system hgpath, 'clone', url, @clone
|
||||
else
|
||||
if @clone.exist? && repo_valid?
|
||||
puts "Updating #{@clone}"
|
||||
Dir.chdir(@clone) do
|
||||
@clone.cd do
|
||||
safe_system hgpath, 'pull'
|
||||
safe_system hgpath, 'update'
|
||||
end
|
||||
elsif @clone.exist?
|
||||
puts "Removing invalid hg repo from cache"
|
||||
@clone.rmtree
|
||||
clone_repo
|
||||
else
|
||||
clone_repo
|
||||
end
|
||||
end
|
||||
|
||||
def repo_valid?
|
||||
@clone.join(".hg").directory?
|
||||
end
|
||||
|
||||
def clone_repo
|
||||
url = @url.sub(%r[^hg://], '')
|
||||
safe_system hgpath, 'clone', url, @clone
|
||||
end
|
||||
|
||||
def stage
|
||||
dst=Dir.getwd
|
||||
Dir.chdir @clone do
|
||||
|
||||
Reference in new issue
Block a user