summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestUpdateHandler.cxx
diff options
context:
space:
mode:
authorPedro Navarro <pnavarro@netflix.com>2013-10-22 22:11:22 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-26 14:24:15 (GMT)
commit970c82348babacb918802dbf615b2224313eef55 (patch)
treeca1f6f1466038ecfcfeb56ce8cca0f3231315e93 /Source/CTest/cmCTestUpdateHandler.cxx
parentddef8a7cfffbbae12f2d2c556651f06346237569 (diff)
downloadCMake-970c82348babacb918802dbf615b2224313eef55.zip
CMake-970c82348babacb918802dbf615b2224313eef55.tar.gz
CMake-970c82348babacb918802dbf615b2224313eef55.tar.bz2
ctest_update: Add support for Perforce p4 client
Teach the ctest_update implementation to use the p4 command-line client to perform updates and extract the list of changes. Add a CTest.UpdateP4 test like those that exist already for the other version control tools. Make the test available when p4 and the p4d server are found. During the test launch p4d in the background to serve a repository from the test directory. Then direct the client toward this server for the duration of the test.
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 9eae3f3..11474ec 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -28,6 +28,7 @@
#include "cmCTestBZR.h"
#include "cmCTestGIT.h"
#include "cmCTestHG.h"
+#include "cmCTestP4.h"
#include <cmsys/auto_ptr.hxx>
@@ -51,7 +52,8 @@ static const char* cmCTestUpdateHandlerUpdateStrings[] =
"SVN",
"BZR",
"GIT",
- "HG"
+ "HG",
+ "P4"
};
static const char* cmCTestUpdateHandlerUpdateToString(int type)
@@ -146,6 +148,10 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
{
return cmCTestUpdateHandler::e_HG;
}
+ if ( stype.find("p4") != std::string::npos )
+ {
+ return cmCTestUpdateHandler::e_P4;
+ }
}
else
{
@@ -172,6 +178,10 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
{
return cmCTestUpdateHandler::e_HG;
}
+ if ( stype.find("p4") != std::string::npos )
+ {
+ return cmCTestUpdateHandler::e_P4;
+ }
}
return cmCTestUpdateHandler::e_UNKNOWN;
}
@@ -223,6 +233,7 @@ int cmCTestUpdateHandler::ProcessHandler()
case e_BZR: vc.reset(new cmCTestBZR(this->CTest, ofs)); break;
case e_GIT: vc.reset(new cmCTestGIT(this->CTest, ofs)); break;
case e_HG: vc.reset(new cmCTestHG(this->CTest, ofs)); break;
+ case e_P4: vc.reset(new cmCTestP4(this->CTest, ofs)); break;
default: vc.reset(new cmCTestVC(this->CTest, ofs)); break;
}
vc->SetCommandLineTool(this->UpdateCommand);
@@ -350,6 +361,18 @@ int cmCTestUpdateHandler::DetectVCS(const char* dir)
{
return cmCTestUpdateHandler::e_HG;
}
+ sourceDirectory = dir;
+ sourceDirectory += "/.p4";
+ if ( cmSystemTools::FileExists(sourceDirectory.c_str()) )
+ {
+ return cmCTestUpdateHandler::e_P4;
+ }
+ sourceDirectory = dir;
+ sourceDirectory += "/.p4config";
+ if ( cmSystemTools::FileExists(sourceDirectory.c_str()) )
+ {
+ return cmCTestUpdateHandler::e_P4;
+ }
return cmCTestUpdateHandler::e_UNKNOWN;
}
@@ -380,6 +403,7 @@ bool cmCTestUpdateHandler::SelectVCS()
case e_BZR: key = "BZRCommand"; break;
case e_GIT: key = "GITCommand"; break;
case e_HG: key = "HGCommand"; break;
+ case e_P4: key = "P4Command"; break;
default: break;
}
if (key)