summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestUpdateHandler.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-02-24 17:52:36 (GMT)
committerBrad King <brad.king@kitware.com>2009-02-24 17:52:36 (GMT)
commitde3dedb4ea68f96deda8f4f1c97ab4f134b89f82 (patch)
tree645508549bd1fa19dacdebb8e4bf64c2839974ed /Source/CTest/cmCTestUpdateHandler.cxx
parentd76bc78a1247d0ac5d151a510b8d6ba231daa043 (diff)
downloadCMake-de3dedb4ea68f96deda8f4f1c97ab4f134b89f82.zip
CMake-de3dedb4ea68f96deda8f4f1c97ab4f134b89f82.tar.gz
CMake-de3dedb4ea68f96deda8f4f1c97ab4f134b89f82.tar.bz2
ENH: Factor out VCS work tree revision checks
This moves checks of the work tree revision before and after update from cmCTestUpdateHandler::ProcessHandler into the cmCTestVC hierarchy.
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx94
1 files changed, 11 insertions, 83 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index ff86882..b42ef5b 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -383,73 +383,18 @@ int cmCTestUpdateHandler::ProcessHandler()
bool res = true;
- // First, check what the current state of repository is
- std::string command = "";
- switch( this->UpdateType )
- {
- case cmCTestUpdateHandler::e_CVS:
- // TODO: CVS - for now just leave empty
- break;
- case cmCTestUpdateHandler::e_SVN:
- command = "\"" + this->UpdateCommand + "\" info";
- break;
- }
-
// CVS variables
// SVN variables
int svn_current_revision = 0;
int svn_latest_revision = 0;
int svn_use_status = 0;
- //
- // Get initial repository information if that is possible. With subversion,
- // this will check the current revision.
- //
- if ( !command.empty() )
+ // Get initial repository information if that is possible.
+ vc->MarkOldRevision();
+ if(this->UpdateType == e_SVN)
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "* Get repository information: " << command.c_str() << std::endl);
- if ( !this->CTest->GetShowOnly() )
- {
- ofs << "* Get repository information" << std::endl;
- ofs << " Command: " << command.c_str() << std::endl;
- res = this->CTest->RunCommand(command.c_str(), &goutput, &errors,
- &retVal, sourceDirectory, 0 /*this->TimeOut*/);
-
- ofs << " Output: " << goutput.c_str() << std::endl;
- ofs << " Errors: " << errors.c_str() << std::endl;
- if ( ofs )
- {
- ofs << "--- Update information ---" << std::endl;
- ofs << goutput << std::endl;
- }
- switch ( this->UpdateType )
- {
- case cmCTestUpdateHandler::e_CVS:
- // TODO: CVS - for now just leave empty
- break;
- case cmCTestUpdateHandler::e_SVN:
- {
- cmsys::RegularExpression current_revision_regex(
- "Revision: ([0-9]+)");
- if ( current_revision_regex.find(goutput.c_str()) )
- {
- std::string currentRevisionString
- = current_revision_regex.match(1);
- svn_current_revision = atoi(currentRevisionString.c_str());
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- " Old revision of repository is: " << svn_current_revision
- << std::endl);
- }
- }
- break;
- }
- }
- else
- {
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Get information with command: " << command << std::endl);
- }
+ svn_current_revision =
+ static_cast<cmCTestSVN*>(vc.get())->GetOldRevision();
}
@@ -468,6 +413,7 @@ int cmCTestUpdateHandler::ProcessHandler()
static_cast<unsigned int>(cmSystemTools::GetTime());
double elapsed_time_start = cmSystemTools::GetTime();
+ std::string command;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "* Update repository: "
<< command.c_str() << std::endl);
if ( !this->CTest->GetShowOnly() )
@@ -570,31 +516,13 @@ int cmCTestUpdateHandler::ProcessHandler()
int numUpdated = 0;
int numModified = 0;
int numConflicting = 0;
- // In subversion, get the latest revision
+
+ // Get final repository information if that is possible.
+ vc->MarkNewRevision();
if ( this->UpdateType == cmCTestUpdateHandler::e_SVN )
{
- for ( cc= 0; cc < lines.size(); cc ++ )
- {
- const char* line = lines[cc].c_str();
- if ( svn_latest_revision_regex.find(line) )
- {
- svn_latest_revision = atoi(
- svn_latest_revision_regex.match(2).c_str());
- }
- }
- if ( svn_latest_revision <= 0 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Problem determining the current "
- "revision of the repository from output:" << std::endl
- << goutput.c_str() << std::endl);
- }
- else
- {
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- " Current revision of repository is: " << svn_latest_revision
- << std::endl);
- }
+ svn_latest_revision =
+ static_cast<cmCTestSVN*>(vc.get())->GetNewRevision();
}
cmCTestLog(this->CTest, HANDLER_OUTPUT,