downloads: Fix checkout on initial clone

Moves the "Checking out" output to where checkouts actually happen, to avoid spurious checkout announcements.

Closes Homebrew/homebrew#45019.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Andrew Janke 2015-10-16 03:59:19 -04:00 committed by Mike McQuaid
parent a9b3c9200e
commit 017a501471

View File

@ -135,10 +135,6 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
end end
end end
def stage
ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
end
def cached_location def cached_location
@clone @clone
end end
@ -503,7 +499,10 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
args = ["svn", svncommand] args = ["svn", svncommand]
args << url unless target.directory? args << url unless target.directory?
args << target args << target
args << "-r" << revision if revision if revision
ohai "Checking out #{ref}"
args << "-r" << revision
end
args << "--ignore-externals" if ignore_externals args << "--ignore-externals" if ignore_externals
quiet_safe_system(*args) quiet_safe_system(*args)
end end
@ -645,11 +644,13 @@ class GitDownloadStrategy < VCSDownloadStrategy
safe_system "git", *clone_args safe_system "git", *clone_args
cached_location.cd do cached_location.cd do
safe_system "git", "config", "homebrew.cacheversion", cache_version safe_system "git", "config", "homebrew.cacheversion", cache_version
checkout
update_submodules if submodules? update_submodules if submodules?
end end
end end
def checkout def checkout
ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
quiet_safe_system "git", "checkout", "-f", @ref, "--" quiet_safe_system "git", "checkout", "-f", @ref, "--"
end end
@ -732,6 +733,7 @@ class MercurialDownloadStrategy < VCSDownloadStrategy
dst = Dir.getwd dst = Dir.getwd
cached_location.cd do cached_location.cd do
if @ref_type && @ref if @ref_type && @ref
ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
safe_system hgpath, "archive", "--subrepos", "-y", "-r", @ref, "-t", "files", dst safe_system hgpath, "archive", "--subrepos", "-y", "-r", @ref, "-t", "files", dst
else else
safe_system hgpath, "archive", "--subrepos", "-y", "-t", "files", dst safe_system hgpath, "archive", "--subrepos", "-y", "-t", "files", dst