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.
This commit is contained in:
parent
41f0f83542
commit
3776690e62
|
@ -481,6 +481,56 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml)
|
||||||
xml << "\t<SVNPath>" << this->RootInfo->Base << "</SVNPath>\n";
|
xml << "\t<SVNPath>" << this->RootInfo->Base << "</SVNPath>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
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 cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,7 @@ private:
|
||||||
SVNInfo* RootInfo;
|
SVNInfo* RootInfo;
|
||||||
|
|
||||||
std::string LoadInfo(SVNInfo& svninfo);
|
std::string LoadInfo(SVNInfo& svninfo);
|
||||||
|
void LoadExternals();
|
||||||
void LoadModifications();
|
void LoadModifications();
|
||||||
void LoadRevisions();
|
void LoadRevisions();
|
||||||
void LoadRevisions(SVNInfo& svninfo);
|
void LoadRevisions(SVNInfo& svninfo);
|
||||||
|
@ -84,10 +85,12 @@ private:
|
||||||
class LogParser;
|
class LogParser;
|
||||||
class StatusParser;
|
class StatusParser;
|
||||||
class UpdateParser;
|
class UpdateParser;
|
||||||
|
class ExternalParser;
|
||||||
friend class InfoParser;
|
friend class InfoParser;
|
||||||
friend class LogParser;
|
friend class LogParser;
|
||||||
friend class StatusParser;
|
friend class StatusParser;
|
||||||
friend class UpdateParser;
|
friend class UpdateParser;
|
||||||
|
friend class ExternalParser;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue