CTestUpdate: Prefer concrete variables over map entries

This commit is contained in:
Daniel Pfeifer
2024-10-23 23:32:02 +02:00
parent 8cac63814c
commit 5497eba1a0
3 changed files with 8 additions and 7 deletions

View File

@@ -79,7 +79,7 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
this->SetError("source directory not specified. Please use SOURCE tag");
return nullptr;
}
handler->SetOption("SourceDirectory", source_dir);
handler->SourceDirectory = source_dir;
handler->SetQuiet(this->Quiet);
return handler;
}

View File

@@ -19,7 +19,6 @@
#include "cmGeneratedFileStream.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
#include "cmVersion.h"
#include "cmXMLWriter.h"
@@ -109,8 +108,7 @@ int cmCTestUpdateHandler::ProcessHandler()
static_cast<void>(fixLocale);
// Get source dir
cmValue sourceDirectory = this->GetOption("SourceDirectory");
if (!sourceDirectory) {
if (this->SourceDirectory.empty()) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
<< std::endl);
@@ -123,7 +121,7 @@ int cmCTestUpdateHandler::ProcessHandler()
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Updating the repository: " << *sourceDirectory
" Updating the repository: " << this->SourceDirectory
<< std::endl,
this->Quiet);
@@ -163,7 +161,7 @@ int cmCTestUpdateHandler::ProcessHandler()
break;
}
vc->SetCommandLineTool(this->UpdateCommand);
vc->SetSourceDirectory(*sourceDirectory);
vc->SetSourceDirectory(this->SourceDirectory);
// Cleanup the working tree.
vc->Cleanup();
@@ -301,7 +299,7 @@ bool cmCTestUpdateHandler::SelectVCS()
this->UpdateCommand = this->CTest->GetCTestConfiguration("UpdateCommand");
// Detect the VCS managing the source tree.
this->UpdateType = this->DetectVCS(this->GetOption("SourceDirectory"));
this->UpdateType = this->DetectVCS(this->SourceDirectory);
if (this->UpdateType == e_UNKNOWN) {
// The source tree does not have a recognized VCS. Check the
// configuration value or command name.

View File

@@ -57,8 +57,11 @@ private:
// The VCS command to update the working tree.
std::string UpdateCommand;
std::string SourceDirectory;
int UpdateType;
int DetectVCS(const std::string& dir);
bool SelectVCS();
friend class cmCTestUpdateCommand;
};