summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestUpdateHandler.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-02-26 14:22:32 (GMT)
committerBrad King <brad.king@kitware.com>2009-02-26 14:22:32 (GMT)
commit3829be4ca66e79310ef19750e877634169c64431 (patch)
tree18aa87c67be3653ad6f33327676423cda0c7955c /Source/CTest/cmCTestUpdateHandler.cxx
parent7960f7541ce3d8d03ce68b0e5a37e67019bbe557 (diff)
downloadCMake-3829be4ca66e79310ef19750e877634169c64431.zip
CMake-3829be4ca66e79310ef19750e877634169c64431.tar.gz
CMake-3829be4ca66e79310ef19750e877634169c64431.tar.bz2
ENH: Refactor initial checkout into cmCTestVC
This adds cmCTestVC::InitialCheckout and uses it in cmCTestUpdateHandler to run the initial checkout command. The new implementation logs the command in the update log consistently with the rest of the new update implementation.
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx46
1 files changed, 6 insertions, 40 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 5ac5ebc..5f4dfc0 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -296,51 +296,17 @@ int cmCTestUpdateHandler::ProcessHandler()
//----------------------------------------------------------------------
bool cmCTestUpdateHandler::InitialCheckout(std::ostream& ofs)
{
- const char* sourceDirectory = this->GetOption("SourceDirectory");
-
// Use the user-provided command to create the source tree.
- const char* initialCheckoutCommand = this->GetOption("InitialCheckout");
- if ( initialCheckoutCommand )
+ if(const char* command = this->GetOption("InitialCheckout"))
{
- std::string goutput;
- std::string errors;
- int retVal = 0;
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- " First perform the initial checkout: " << initialCheckoutCommand
- << std::endl);
- cmStdString parent = cmSystemTools::GetParentDirectory(sourceDirectory);
- if ( parent.empty() )
+ // Use a generic VC object to run and log the command.
+ cmCTestVC vc(this->CTest, ofs);
+ vc.SetSourceDirectory(this->GetOption("SourceDirectory"));
+ if(!vc.InitialCheckout(command))
{
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Something went wrong when trying "
- "to determine the parent directory of " << sourceDirectory
- << std::endl);
return false;
}
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- " Perform checkout in directory: " << parent.c_str() << std::endl);
- if ( !cmSystemTools::MakeDirectory(parent.c_str()) )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot create parent directory: " << parent.c_str()
- << " of the source directory: " << sourceDirectory << std::endl);
- return false;
- }
- ofs << "* Run initial checkout" << std::endl;
- ofs << " Command: " << initialCheckoutCommand << std::endl;
- cmCTestLog(this->CTest, DEBUG, " Before: "
- << initialCheckoutCommand << std::endl);
- bool retic = this->CTest->RunCommand(initialCheckoutCommand, &goutput,
- &errors, &retVal, parent.c_str(), 0 /* Timeout */);
- cmCTestLog(this->CTest, DEBUG, " After: "
- << initialCheckoutCommand << std::endl);
- ofs << " Output: " << goutput.c_str() << std::endl;
- ofs << " Errors: " << errors.c_str() << std::endl;
- if ( !retic || retVal )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Initial checkout failed:\n"
- << goutput << "\n" << errors << "\n");
- }
+
if(!this->CTest->InitializeFromCommand(this->Command))
{
cmCTestLog(this->CTest, HANDLER_OUTPUT,