summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestSVN.cxx
diff options
context:
space:
mode:
authorXavier Besseron <xavier.besseron@uni.lu>2012-09-03 09:03:43 (GMT)
committerBrad King <brad.king@kitware.com>2012-09-04 12:35:36 (GMT)
commit3776690e62c631edd520f566b2ebcaffbad230b4 (patch)
tree09d368e0a5656331ce1c29ca05fa3bf155c88606 /Source/CTest/cmCTestSVN.cxx
parent41f0f83542ce8d69e4d9a4512a6dc66327f20c8d (diff)
downloadCMake-3776690e62c631edd520f566b2ebcaffbad230b4.zip
CMake-3776690e62c631edd520f566b2ebcaffbad230b4.tar.gz
CMake-3776690e62c631edd520f566b2ebcaffbad230b4.tar.bz2
cmCTestSVN: Add a LoadExternal() function and an ExternalParser class
This call 'svn status' and parse the result to get the list of externals repositories. The external repositories found are added to the Repositories list.
Diffstat (limited to 'Source/CTest/cmCTestSVN.cxx')
-rw-r--r--Source/CTest/cmCTestSVN.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 32b1ef9..b27c633 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -482,6 +482,56 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml)
}
//----------------------------------------------------------------------------
+class cmCTestSVN::ExternalParser: public cmCTestVC::LineParser
+{
+public:
+ ExternalParser(cmCTestSVN* svn, const char* prefix): SVN(svn)
+ {
+ this->SetLog(&svn->Log, prefix);
+ this->RegexExternal.compile("^X..... +(.+)$");
+ }
+private:
+ cmCTestSVN* SVN;
+ cmsys::RegularExpression RegexExternal;
+ bool ProcessLine()
+ {
+ if(this->RegexExternal.find(this->Line))
+ {
+ this->DoPath(this->RegexExternal.match(1));
+ }
+ return true;
+ }
+
+ void DoPath(std::string const& path)
+ {
+ // Get local path relative to the source directory
+ std::string local_path;
+ if(path.size() > this->SVN->SourceDirectory.size() &&
+ strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(),
+ this->SVN->SourceDirectory.size()) == 0)
+ {
+ local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1;
+ }
+ else
+ {
+ local_path = path;
+ }
+ this->SVN->Repositories.push_back( SVNInfo(local_path.c_str()) );
+ }
+};
+
+//----------------------------------------------------------------------------
+void cmCTestSVN::LoadExternals()
+{
+ // Run "svn status" to get the list of external repositories
+ const char* svn = this->CommandLineTool.c_str();
+ const char* svn_status[] = {svn, "status", 0};
+ ExternalParser out(this, "external-out> ");
+ OutputLogger err(this->Log, "external-err> ");
+ this->RunChild(svn_status, &out, &err);
+}
+
+//----------------------------------------------------------------------------
std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const
{
std::string local_path;