diff options
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 50 | ||||
-rw-r--r-- | Source/CTest/cmCTestSVN.h | 3 |
2 files changed, 53 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; diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 4fb37a6..56265d0 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -68,6 +68,7 @@ private: SVNInfo* RootInfo; std::string LoadInfo(SVNInfo& svninfo); + void LoadExternals(); void LoadModifications(); void LoadRevisions(); void LoadRevisions(SVNInfo& svninfo); @@ -84,10 +85,12 @@ private: class LogParser; class StatusParser; class UpdateParser; + class ExternalParser; friend class InfoParser; friend class LogParser; friend class StatusParser; friend class UpdateParser; + friend class ExternalParser; }; #endif |