diff options
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 46 |
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, |