diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-06-08 12:50:10 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-08-29 14:51:30 (GMT) |
commit | ec124582acf966db9e6ddb226b53021fe6be591a (patch) | |
tree | bd0b3056158f944b5469aa364cd7720e83acd766 /Source/CTest/cmCTestHG.cxx | |
parent | 5420639a8d696055577de638e0952d6936706f18 (diff) | |
download | CMake-ec124582acf966db9e6ddb226b53021fe6be591a.zip CMake-ec124582acf966db9e6ddb226b53021fe6be591a.tar.gz CMake-ec124582acf966db9e6ddb226b53021fe6be591a.tar.bz2 |
cmProcessTools::RunProcess(): Replace cmsysProcess with cmUVProcessChain
And convert the VCS code to std::vector<std::string>.
Diffstat (limited to 'Source/CTest/cmCTestHG.cxx')
-rw-r--r-- | Source/CTest/cmCTestHG.cxx | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 02837ba..e1a945d 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -95,8 +95,8 @@ private: std::string cmCTestHG::GetWorkingRevision() { // Run plumbing "hg identify" to get work tree revision. - const char* hg = this->CommandLineTool.c_str(); - const char* hg_identify[] = { hg, "identify", "-i", nullptr }; + std::string hg = this->CommandLineTool; + std::vector<std::string> hg_identify = { hg, "identify", "-i" }; std::string rev; IdentifyParser out(this, "rev-out> ", rev); OutputLogger err(this->Log, "rev-err> "); @@ -127,16 +127,16 @@ bool cmCTestHG::UpdateImpl() { // Use "hg pull" followed by "hg update" to update the working tree. { - const char* hg = this->CommandLineTool.c_str(); - const char* hg_pull[] = { hg, "pull", "-v", nullptr }; + std::string hg = this->CommandLineTool; + std::vector<std::string> hg_pull = { hg, "pull", "-v" }; OutputLogger out(this->Log, "pull-out> "); OutputLogger err(this->Log, "pull-err> "); - this->RunChild(&hg_pull[0], &out, &err); + this->RunChild(hg_pull, &out, &err); } // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) - std::vector<char const*> hg_update; + std::vector<std::string> hg_update; hg_update.push_back(this->CommandLineTool.c_str()); hg_update.push_back("update"); hg_update.push_back("-v"); @@ -147,16 +147,11 @@ bool cmCTestHG::UpdateImpl() opts = this->CTest->GetCTestConfiguration("HGUpdateOptions"); } std::vector<std::string> args = cmSystemTools::ParseArguments(opts); - for (std::string const& arg : args) { - hg_update.push_back(arg.c_str()); - } - - // Sentinel argument. - hg_update.push_back(nullptr); + cm::append(hg_update, args); OutputLogger out(this->Log, "update-out> "); OutputLogger err(this->Log, "update-err> "); - return this->RunUpdateCommand(hg_update.data(), &out, &err); + return this->RunUpdateCommand(hg_update, &out, &err); } class cmCTestHG::LogParser @@ -277,8 +272,8 @@ bool cmCTestHG::LoadRevisions() // the project has spaces in the path. Also, they may not have // proper XML escapes. std::string range = this->OldRevision + ":" + this->NewRevision; - const char* hg = this->CommandLineTool.c_str(); - const char* hgXMLTemplate = "<logentry\n" + std::string hg = this->CommandLineTool; + std::string hgXMLTemplate = "<logentry\n" " revision=\"{node|short}\">\n" " <author>{author|person}</author>\n" " <email>{author|email}</email>\n" @@ -288,10 +283,8 @@ bool cmCTestHG::LoadRevisions() " <file_adds>{file_adds}</file_adds>\n" " <file_dels>{file_dels}</file_dels>\n" "</logentry>\n"; - const char* hg_log[] = { - hg, "log", "--removed", "-r", range.c_str(), - "--template", hgXMLTemplate, nullptr - }; + std::vector<std::string> hg_log = { hg, "log", "--removed", "-r", + range, "--template", hgXMLTemplate }; LogParser out(this, "log-out> "); out.Process("<?xml version=\"1.0\"?>\n" @@ -305,8 +298,8 @@ bool cmCTestHG::LoadRevisions() bool cmCTestHG::LoadModifications() { // Use 'hg status' to get modified files. - const char* hg = this->CommandLineTool.c_str(); - const char* hg_status[] = { hg, "status", nullptr }; + std::string hg = this->CommandLineTool; + std::vector<std::string> hg_status = { hg, "status" }; StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); this->RunChild(hg_status, &out, &err); |