2004-09-07 17:17:15 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
2004-09-07 17:17:15 +04:00
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#include "cmCTestUpdateHandler.h"
|
|
|
|
|
|
|
|
#include "cmCTest.h"
|
|
|
|
#include "cmake.h"
|
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmLocalGenerator.h"
|
|
|
|
#include "cmGlobalGenerator.h"
|
2004-10-22 23:44:54 +04:00
|
|
|
#include "cmVersion.h"
|
2005-01-27 18:15:01 +03:00
|
|
|
#include "cmGeneratedFileStream.h"
|
2005-02-16 21:28:47 +03:00
|
|
|
#include "cmXMLParser.h"
|
2004-09-07 17:17:15 +04:00
|
|
|
|
|
|
|
//#include <cmsys/RegularExpression.hxx>
|
|
|
|
#include <cmsys/Process.h>
|
|
|
|
|
|
|
|
// used for sleep
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include "windows.h"
|
|
|
|
#endif
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
#include <stdlib.h>
|
2004-09-07 17:17:15 +04:00
|
|
|
#include <math.h>
|
|
|
|
#include <float.h>
|
|
|
|
|
2005-06-17 21:04:56 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
static const char* cmCTestUpdateHandlerUpdateStrings[] =
|
|
|
|
{
|
|
|
|
"Unknown",
|
|
|
|
"CVS",
|
|
|
|
"SVN"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char* cmCTestUpdateHandlerUpdateToString(int type)
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
if ( type < cmCTestUpdateHandler::e_UNKNOWN ||
|
|
|
|
type >= cmCTestUpdateHandler::e_LAST )
|
2005-06-17 21:04:56 +04:00
|
|
|
{
|
|
|
|
return cmCTestUpdateHandlerUpdateStrings[cmCTestUpdateHandler::e_UNKNOWN];
|
|
|
|
}
|
|
|
|
return cmCTestUpdateHandlerUpdateStrings[type];
|
|
|
|
}
|
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
//**********************************************************************
|
|
|
|
class cmCTestUpdateHandlerSVNXMLParser : public cmXMLParser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct t_CommitLog
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
int Revision;
|
|
|
|
std::string Author;
|
|
|
|
std::string Date;
|
|
|
|
std::string Message;
|
2005-02-16 21:28:47 +03:00
|
|
|
};
|
|
|
|
cmCTestUpdateHandlerSVNXMLParser(cmCTestUpdateHandler* up)
|
2006-03-10 23:03:09 +03:00
|
|
|
: cmXMLParser(), UpdateHandler(up), MinRevision(-1), MaxRevision(-1)
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int Parse(const char* str)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->MinRevision = -1;
|
|
|
|
this->MaxRevision = -1;
|
2005-02-16 21:28:47 +03:00
|
|
|
int res = this->cmXMLParser::Parse(str);
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->MinRevision == -1 || this->MaxRevision == -1 )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef std::vector<t_CommitLog> t_VectorOfCommits;
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
t_VectorOfCommits* GetCommits() { return &this->Commits; }
|
|
|
|
int GetMinRevision() { return this->MinRevision; }
|
|
|
|
int GetMaxRevision() { return this->MaxRevision; }
|
2005-02-16 21:28:47 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void StartElement(const char* name, const char** atts)
|
|
|
|
{
|
|
|
|
if ( strcmp(name, "logentry") == 0 )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CommitLog = t_CommitLog();
|
2005-02-16 21:28:47 +03:00
|
|
|
const char* rev = this->FindAttribute(atts, "revision");
|
|
|
|
if ( rev)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CommitLog.Revision = atoi(rev);
|
|
|
|
if ( this->MinRevision < 0 ||
|
|
|
|
this->MinRevision > this->CommitLog.Revision )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->MinRevision = this->CommitLog.Revision;
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->MaxRevision < 0 ||
|
|
|
|
this->MaxRevision < this->CommitLog.Revision )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->MaxRevision = this->CommitLog.Revision;
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CharacterData.erase(
|
|
|
|
this->CharacterData.begin(), this->CharacterData.end());
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
void EndElement(const char* name)
|
|
|
|
{
|
|
|
|
if ( strcmp(name, "logentry") == 0 )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->UpdateHandler->GetCTestInstance(),
|
|
|
|
HANDLER_VERBOSE_OUTPUT,
|
|
|
|
"\tRevision: " << this->CommitLog.Revision<< std::endl
|
|
|
|
<< "\tAuthor: " << this->CommitLog.Author.c_str() << std::endl
|
|
|
|
<< "\tDate: " << this->CommitLog.Date.c_str() << std::endl
|
|
|
|
<< "\tMessage: " << this->CommitLog.Message.c_str() << std::endl);
|
|
|
|
this->Commits.push_back(this->CommitLog);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
else if ( strcmp(name, "author") == 0 )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CommitLog.Author.assign(&(*(this->CharacterData.begin())),
|
|
|
|
this->CharacterData.size());
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
else if ( strcmp(name, "date") == 0 )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CommitLog.Date.assign(&(*(this->CharacterData.begin())),
|
|
|
|
this->CharacterData.size());
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
else if ( strcmp(name, "msg") == 0 )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CommitLog.Message.assign(&(*(this->CharacterData.begin())),
|
|
|
|
this->CharacterData.size());
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CharacterData.erase(this->CharacterData.begin(),
|
|
|
|
this->CharacterData.end());
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
void CharacterDataHandler(const char* data, int length)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CharacterData.insert(this->CharacterData.end(), data, data+length);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
const char* FindAttribute( const char** atts, const char* attribute )
|
|
|
|
{
|
|
|
|
if ( !atts || !attribute )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
const char **atr = atts;
|
|
|
|
while ( *atr && **atr && **(atr+1) )
|
|
|
|
{
|
|
|
|
if ( strcmp(*atr, attribute) == 0 )
|
|
|
|
{
|
|
|
|
return *(atr+1);
|
|
|
|
}
|
|
|
|
atr+=2;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2006-03-10 23:03:09 +03:00
|
|
|
std::vector<char> CharacterData;
|
|
|
|
cmCTestUpdateHandler* UpdateHandler;
|
|
|
|
t_CommitLog CommitLog;
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
t_VectorOfCommits Commits;
|
|
|
|
int MinRevision;
|
|
|
|
int MaxRevision;
|
2005-02-16 21:28:47 +03:00
|
|
|
};
|
|
|
|
//**********************************************************************
|
|
|
|
//----------------------------------------------------------------------
|
2004-09-07 17:17:15 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
cmCTestUpdateHandler::cmCTestUpdateHandler()
|
|
|
|
{
|
2005-06-17 21:04:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestUpdateHandler::Initialize()
|
|
|
|
{
|
2005-06-23 21:04:18 +04:00
|
|
|
this->Superclass::Initialize();
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Determine update type from command: " << cmd
|
2006-03-09 19:17:10 +03:00
|
|
|
<< " and type: " << type << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( type && *type )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Type specified: " << type << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
std::string stype = cmSystemTools::LowerCase(type);
|
|
|
|
if ( stype.find("cvs") != std::string::npos )
|
|
|
|
{
|
|
|
|
return cmCTestUpdateHandler::e_CVS;
|
|
|
|
}
|
|
|
|
if ( stype.find("svn") != std::string::npos )
|
|
|
|
{
|
|
|
|
return cmCTestUpdateHandler::e_SVN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Type not specified, check command: "
|
|
|
|
<< cmd << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
std::string stype = cmSystemTools::LowerCase(cmd);
|
|
|
|
if ( stype.find("cvs") != std::string::npos )
|
|
|
|
{
|
|
|
|
return cmCTestUpdateHandler::e_CVS;
|
|
|
|
}
|
|
|
|
if ( stype.find("svn") != std::string::npos )
|
|
|
|
{
|
|
|
|
return cmCTestUpdateHandler::e_SVN;
|
|
|
|
}
|
|
|
|
}
|
2005-06-17 21:04:56 +04:00
|
|
|
std::string sourceDirectory = this->GetOption("SourceDirectory");
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Check directory: "
|
|
|
|
<< sourceDirectory.c_str() << std::endl);
|
2005-06-17 21:04:56 +04:00
|
|
|
sourceDirectory += "/.svn";
|
|
|
|
if ( cmSystemTools::FileExists(sourceDirectory.c_str()) )
|
|
|
|
{
|
|
|
|
return cmCTestUpdateHandler::e_SVN;
|
|
|
|
}
|
|
|
|
sourceDirectory = this->GetOption("SourceDirectory");
|
|
|
|
sourceDirectory += "/CVS";
|
|
|
|
if ( cmSystemTools::FileExists(sourceDirectory.c_str()) )
|
|
|
|
{
|
|
|
|
return cmCTestUpdateHandler::e_CVS;
|
|
|
|
}
|
|
|
|
return cmCTestUpdateHandler::e_UNKNOWN;
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2004-09-07 17:17:15 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
//clearly it would be nice if this were broken up into a few smaller
|
|
|
|
//functions and commented...
|
2005-01-27 23:54:47 +03:00
|
|
|
int cmCTestUpdateHandler::ProcessHandler()
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
|
|
|
int count = 0;
|
2005-02-16 21:28:47 +03:00
|
|
|
int updateType = e_CVS;
|
2004-09-07 17:17:15 +04:00
|
|
|
std::string::size_type cc, kk;
|
2005-04-24 20:32:56 +04:00
|
|
|
bool updateProducedError = false;
|
2005-06-16 21:18:21 +04:00
|
|
|
std::string goutput;
|
|
|
|
std::string errors;
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2005-06-16 21:18:21 +04:00
|
|
|
std::string checkoutErrorMessages;
|
|
|
|
int retVal = 0;
|
2005-02-16 21:28:47 +03:00
|
|
|
|
|
|
|
// Get source dir
|
2005-02-17 23:23:00 +03:00
|
|
|
const char* sourceDirectory = this->GetOption("SourceDirectory");
|
|
|
|
if ( !sourceDirectory )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
|
|
|
|
<< std::endl);
|
2004-09-07 17:17:15 +04:00
|
|
|
return -1;
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2005-06-16 21:18:21 +04:00
|
|
|
cmGeneratedFileStream ofs;
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->CTest->GetShowOnly() )
|
2005-06-16 21:18:21 +04:00
|
|
|
{
|
2005-06-23 21:04:18 +04:00
|
|
|
this->StartLogFile("Update", ofs);
|
2005-06-16 21:18:21 +04:00
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
|
|
|
"Updating the repository" << std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
|
|
|
|
const char* initialCheckoutCommand = this->GetOption("InitialCheckout");
|
|
|
|
if ( initialCheckoutCommand )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
2006-10-26 19:01:52 +04:00
|
|
|
" First perform the initial checkout: " << initialCheckoutCommand
|
2006-03-09 19:17:10 +03:00
|
|
|
<< std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
cmStdString parent = cmSystemTools::GetParentDirectory(sourceDirectory);
|
|
|
|
if ( parent.empty() )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"Something went wrong when trying "
|
2006-03-09 19:17:10 +03:00
|
|
|
"to determine the parent directory of " << sourceDirectory
|
|
|
|
<< std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
return -1;
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
|
|
|
" Perform checkout in directory: " << parent.c_str() << std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
if ( !cmSystemTools::MakeDirectory(parent.c_str()) )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Cannot create parent directory: " << parent.c_str()
|
|
|
|
<< " of the source directory: " << sourceDirectory << std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ofs << "* Run initial checkout" << std::endl;
|
|
|
|
ofs << " Command: " << initialCheckoutCommand << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, " Before: "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< initialCheckoutCommand << std::endl);
|
2006-03-10 23:03:09 +03:00
|
|
|
bool retic = this->CTest->RunCommand(initialCheckoutCommand, &goutput,
|
2006-03-09 19:17:10 +03:00
|
|
|
&errors, &retVal, parent.c_str(), 0 /* Timeout */);
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, " After: "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< initialCheckoutCommand << std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
ofs << " Output: " << goutput.c_str() << std::endl;
|
|
|
|
ofs << " Errors: " << errors.c_str() << std::endl;
|
|
|
|
if ( !retic || retVal )
|
|
|
|
{
|
|
|
|
cmOStringStream ostr;
|
2006-03-09 19:17:10 +03:00
|
|
|
ostr << "Problem running initial checkout Output [" << goutput
|
|
|
|
<< "] Errors [" << errors << "]";
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, ostr.str().c_str() << std::endl);
|
2005-06-16 21:18:21 +04:00
|
|
|
checkoutErrorMessages += ostr.str();
|
|
|
|
updateProducedError = true;
|
|
|
|
}
|
2007-08-04 00:42:47 +04:00
|
|
|
if(!this->CTest->InitializeFromCommand(this->Command))
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
|
|
|
" Fatal Error in initialize: "
|
|
|
|
<< std::endl);
|
|
|
|
cmSystemTools::SetFatalErrorOccured();
|
|
|
|
return -1;
|
|
|
|
}
|
2005-06-16 21:18:21 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Updating the repository: "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< sourceDirectory << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
|
|
|
|
// Get update command
|
2006-03-10 23:03:09 +03:00
|
|
|
std::string updateCommand
|
|
|
|
= this->CTest->GetCTestConfiguration("UpdateCommand");
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( updateCommand.empty() )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
updateCommand = this->CTest->GetCTestConfiguration("CVSCommand");
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( updateCommand.empty() )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
updateCommand = this->CTest->GetCTestConfiguration("SVNCommand");
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( updateCommand.empty() )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Cannot find CVSCommand, SVNCommand, or UpdateCommand key in the "
|
|
|
|
"DartConfiguration.tcl" << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateType = e_SVN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateType = e_CVS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
updateType = this->DetermineType(updateCommand.c_str(),
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CTest->GetCTestConfiguration("UpdateType").c_str());
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< cmCTestUpdateHandlerUpdateToString(updateType) << " repository type"
|
|
|
|
<< std::endl;);
|
2005-06-17 21:04:56 +04:00
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
// And update options
|
2006-03-10 23:03:09 +03:00
|
|
|
std::string updateOptions
|
|
|
|
= this->CTest->GetCTestConfiguration("UpdateOptions");
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( updateOptions.empty() )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
switch (updateType)
|
|
|
|
{
|
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
2006-03-10 23:03:09 +03:00
|
|
|
updateOptions = this->CTest->GetCTestConfiguration("CVSUpdateOptions");
|
2005-07-11 19:59:51 +04:00
|
|
|
if ( updateOptions.empty() )
|
|
|
|
{
|
|
|
|
updateOptions = "-dP";
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
2006-03-10 23:03:09 +03:00
|
|
|
updateOptions = this->CTest->GetCTestConfiguration("SVNUpdateOptions");
|
2005-02-16 21:28:47 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
// Get update time
|
2004-09-07 17:17:15 +04:00
|
|
|
std::string extra_update_opts;
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->CTest->GetTestModel() == cmCTest::NIGHTLY )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
struct tm* t = this->CTest->GetNightlyTime(
|
|
|
|
this->CTest->GetCTestConfiguration("NightlyStartTime"),
|
|
|
|
this->CTest->GetTomorrowTag());
|
2004-09-07 17:17:15 +04:00
|
|
|
char current_time[1024];
|
2005-02-16 21:28:47 +03:00
|
|
|
sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d",
|
2004-09-07 17:17:15 +04:00
|
|
|
t->tm_year + 1900,
|
|
|
|
t->tm_mon + 1,
|
|
|
|
t->tm_mday,
|
|
|
|
t->tm_hour,
|
|
|
|
t->tm_min,
|
|
|
|
t->tm_sec);
|
|
|
|
std::string today_update_date = current_time;
|
2005-02-16 21:28:47 +03:00
|
|
|
|
|
|
|
// TODO: SVN
|
|
|
|
switch ( updateType )
|
|
|
|
{
|
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
|
|
|
extra_update_opts += "-D \"" + today_update_date +" UTC\"";
|
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
|
|
|
extra_update_opts += "-r \"{" + today_update_date +" +0000}\"";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-15 17:23:35 +03:00
|
|
|
bool res = true;
|
|
|
|
|
2005-05-04 19:16:53 +04:00
|
|
|
updateCommand = "\"" + updateCommand + "\"";
|
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
// First, check what the current state of repository is
|
|
|
|
std::string command = "";
|
2006-03-15 17:23:35 +03:00
|
|
|
switch( updateType )
|
|
|
|
{
|
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
|
|
|
// TODO: CVS - for now just leave empty
|
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
|
|
|
command = updateCommand + " cleanup";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Get initial repository information if that is possible. With subversion,
|
|
|
|
// this will check the current revision.
|
|
|
|
//
|
|
|
|
if ( !command.empty() )
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
|
"* Cleanup repository: " << command.c_str() << std::endl);
|
|
|
|
if ( !this->CTest->GetShowOnly() )
|
|
|
|
{
|
|
|
|
ofs << "* Cleanup repository" << 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 << "--- Cleanup ---" << std::endl;
|
|
|
|
ofs << goutput << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
|
"Cleanup with command: " << command << std::endl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// First, check what the current state of repository is
|
|
|
|
command = "";
|
2005-02-16 21:28:47 +03:00
|
|
|
switch( updateType )
|
|
|
|
{
|
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
|
|
|
// TODO: CVS - for now just leave empty
|
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
|
|
|
command = updateCommand + " info";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CVS variables
|
|
|
|
// SVN variables
|
|
|
|
int svn_current_revision = 0;
|
|
|
|
int svn_latest_revision = 0;
|
|
|
|
int svn_use_status = 0;
|
|
|
|
|
2005-04-24 21:57:11 +04:00
|
|
|
//
|
2006-03-09 19:17:10 +03:00
|
|
|
// Get initial repository information if that is possible. With subversion,
|
|
|
|
// this will check the current revision.
|
2005-04-24 21:57:11 +04:00
|
|
|
//
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( !command.empty() )
|
|
|
|
{
|
2006-03-15 17:23:35 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
|
"* Get repository information: " << command.c_str() << std::endl);
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->CTest->GetShowOnly() )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << "* Get repository information" << std::endl;
|
|
|
|
ofs << " Command: " << command.c_str() << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
res = this->CTest->RunCommand(command.c_str(), &goutput, &errors,
|
|
|
|
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
|
2005-06-14 19:42:53 +04:00
|
|
|
|
|
|
|
ofs << " Output: " << goutput.c_str() << std::endl;
|
|
|
|
ofs << " Errors: " << errors.c_str() << std::endl;
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( ofs )
|
|
|
|
{
|
|
|
|
ofs << "--- Update information ---" << std::endl;
|
|
|
|
ofs << goutput << std::endl;
|
|
|
|
}
|
|
|
|
switch ( updateType )
|
|
|
|
{
|
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
|
|
|
// TODO: CVS - for now just leave empty
|
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
cmsys::RegularExpression current_revision_regex(
|
|
|
|
"Revision: ([0-9]+)");
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( current_revision_regex.find(goutput.c_str()) )
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
std::string currentRevisionString
|
|
|
|
= current_revision_regex.match(1);
|
2005-02-16 21:28:47 +03:00
|
|
|
svn_current_revision = atoi(currentRevisionString.c_str());
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
2006-03-09 19:17:10 +03:00
|
|
|
" Old revision of repository is: " << svn_current_revision
|
|
|
|
<< std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
2006-03-15 17:23:35 +03:00
|
|
|
"Get information with command: " << command << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2005-04-24 21:57:11 +04:00
|
|
|
//
|
|
|
|
// Now update repository and remember what files were updated
|
2006-03-10 23:03:09 +03:00
|
|
|
//
|
|
|
|
cmGeneratedFileStream os;
|
2005-06-23 21:04:18 +04:00
|
|
|
if ( !this->StartResultingXML("Update", os) )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file"
|
|
|
|
<< std::endl);
|
2007-08-04 00:42:47 +04:00
|
|
|
return -1;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
std::string start_time = this->CTest->CurrentTime();
|
2008-01-30 19:54:55 +03:00
|
|
|
unsigned int start_time_time = static_cast<unsigned int>(cmSystemTools::GetTime());
|
2004-09-07 17:17:15 +04:00
|
|
|
double elapsed_time_start = cmSystemTools::GetTime();
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "* Update repository: "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< command.c_str() << std::endl);
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->CTest->GetShowOnly() )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-04-24 21:57:11 +04:00
|
|
|
command = "";
|
|
|
|
switch( updateType )
|
|
|
|
{
|
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
|
|
|
command = updateCommand + " -z3 update " + updateOptions +
|
|
|
|
" " + extra_update_opts;
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << "* Update repository: " << std::endl;
|
|
|
|
ofs << " Command: " << command.c_str() << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
res = this->CTest->RunCommand(command.c_str(), &goutput, &errors,
|
|
|
|
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << " Output: " << goutput.c_str() << std::endl;
|
|
|
|
ofs << " Errors: " << errors.c_str() << std::endl;
|
2005-04-24 21:57:11 +04:00
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
|
|
|
{
|
|
|
|
std::string partialOutput;
|
|
|
|
command = updateCommand + " update " + updateOptions +
|
|
|
|
" " + extra_update_opts;
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << "* Update repository: " << std::endl;
|
|
|
|
ofs << " Command: " << command.c_str() << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
bool res1 = this->CTest->RunCommand(command.c_str(), &partialOutput,
|
2006-03-09 19:17:10 +03:00
|
|
|
&errors,
|
2006-03-10 23:03:09 +03:00
|
|
|
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << " Output: " << partialOutput.c_str() << std::endl;
|
|
|
|
ofs << " Errors: " << errors.c_str() << std::endl;
|
2005-06-17 21:04:56 +04:00
|
|
|
goutput = partialOutput;
|
2005-04-24 21:57:11 +04:00
|
|
|
command = updateCommand + " status";
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << "* Status repository: " << std::endl;
|
|
|
|
ofs << " Command: " << command.c_str() << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
res = this->CTest->RunCommand(command.c_str(), &partialOutput,
|
|
|
|
&errors, &retVal, sourceDirectory, 0 /*this->TimeOut*/);
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << " Output: " << partialOutput.c_str() << std::endl;
|
|
|
|
ofs << " Errors: " << errors.c_str() << std::endl;
|
2005-04-24 21:57:11 +04:00
|
|
|
goutput += partialOutput;
|
2005-04-26 19:09:29 +04:00
|
|
|
res = res && res1;
|
2005-06-17 21:04:56 +04:00
|
|
|
ofs << " Total output of update: " << goutput.c_str() << std::endl;
|
2005-04-24 21:57:11 +04:00
|
|
|
}
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( ofs )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
ofs << "--- Update repository ---" << std::endl;
|
2006-03-09 19:17:10 +03:00
|
|
|
ofs << goutput << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
}
|
2005-04-22 02:23:28 +04:00
|
|
|
if ( !res || retVal )
|
|
|
|
{
|
2005-04-24 20:32:56 +04:00
|
|
|
updateProducedError = true;
|
2005-06-16 21:18:21 +04:00
|
|
|
checkoutErrorMessages += " " + goutput;
|
2005-04-22 02:23:28 +04:00
|
|
|
}
|
2004-09-07 17:17:15 +04:00
|
|
|
|
|
|
|
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "<Update mode=\"Client\" Generator=\"ctest-"
|
|
|
|
<< cmVersion::GetCMakeVersion() << "\">\n"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< "\t<Site>" << this->CTest->GetCTestConfiguration("Site") << "</Site>\n"
|
|
|
|
<< "\t<BuildName>" << this->CTest->GetCTestConfiguration("BuildName")
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "</BuildName>\n"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< "\t<BuildStamp>" << this->CTest->GetCurrentTag() << "-"
|
|
|
|
<< this->CTest->GetTestModelString() << "</BuildStamp>" << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
|
2008-01-30 19:17:36 +03:00
|
|
|
<< "\t<StartTime>" << start_time_time << "</StartTime>\n"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< "\t<UpdateCommand>" << this->CTest->MakeXMLSafe(command)
|
2005-06-17 21:04:56 +04:00
|
|
|
<< "</UpdateCommand>\n"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< "\t<UpdateType>" << this->CTest->MakeXMLSafe(
|
2006-03-09 19:17:10 +03:00
|
|
|
cmCTestUpdateHandlerUpdateToString(updateType))
|
2005-06-17 21:04:56 +04:00
|
|
|
<< "</UpdateType>\n";
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
// Even though it failed, we may have some useful information. Try to
|
|
|
|
// continue...
|
2005-02-16 21:28:47 +03:00
|
|
|
std::vector<cmStdString> lines;
|
|
|
|
cmSystemTools::Split(goutput.c_str(), lines);
|
2005-07-21 23:54:57 +04:00
|
|
|
std::vector<cmStdString> errLines;
|
|
|
|
cmSystemTools::Split(errors.c_str(), errLines);
|
|
|
|
lines.insert(lines.end(), errLines.begin(), errLines.end());
|
2005-02-16 21:28:47 +03:00
|
|
|
|
|
|
|
// CVS style regular expressions
|
2006-03-09 19:17:10 +03:00
|
|
|
cmsys::RegularExpression cvs_date_author_regex(
|
|
|
|
"^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
|
2005-02-16 21:28:47 +03:00
|
|
|
cmsys::RegularExpression cvs_revision_regex("^revision +([^ ]*) *$");
|
2006-03-09 19:17:10 +03:00
|
|
|
cmsys::RegularExpression cvs_end_of_file_regex(
|
|
|
|
"^=========================================="
|
|
|
|
"===================================$");
|
|
|
|
cmsys::RegularExpression cvs_end_of_comment_regex(
|
|
|
|
"^----------------------------$");
|
2005-02-16 21:28:47 +03:00
|
|
|
|
|
|
|
// Subversion style regular expressions
|
2006-03-09 19:17:10 +03:00
|
|
|
cmsys::RegularExpression svn_status_line_regex(
|
|
|
|
"^ *([0-9]+) *([0-9]+) *([^ ]+) *([^ ][^\t\r\n]*)[ \t\r\n]*$");
|
|
|
|
cmsys::RegularExpression svn_latest_revision_regex(
|
|
|
|
"(Updated to|At) revision ([0-9]+)\\.");
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
cmsys::RegularExpression file_removed_line(
|
|
|
|
"cvs update: `(.*)' is no longer in the repository");
|
2005-02-16 21:28:47 +03:00
|
|
|
cmsys::RegularExpression file_update_line("([A-Z]) *(.*)");
|
|
|
|
std::string current_path = "<no-path>";
|
|
|
|
bool first_file = true;
|
|
|
|
|
|
|
|
cmCTestUpdateHandler::AuthorsToUpdatesMap authors_files_map;
|
2006-03-10 23:03:09 +03:00
|
|
|
int numUpdated = 0;
|
|
|
|
int numModiefied = 0;
|
|
|
|
int numConflicting = 0;
|
2005-02-16 21:28:47 +03:00
|
|
|
// In subversion, get the latest revision
|
|
|
|
if ( updateType == cmCTestUpdateHandler::e_SVN )
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
for ( cc= 0; cc < lines.size(); cc ++ )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
|
|
|
const char* line = lines[cc].c_str();
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( svn_latest_revision_regex.find(line) )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
svn_latest_revision = atoi(
|
|
|
|
svn_latest_revision_regex.match(2).c_str());
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
}
|
2005-07-11 19:16:14 +04:00
|
|
|
if ( svn_latest_revision <= 0 )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"Problem determining the current "
|
2006-03-09 19:17:10 +03:00
|
|
|
"revision of the repository from output:" << std::endl
|
|
|
|
<< goutput.c_str() << std::endl);
|
2005-07-11 19:16:14 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
2006-03-09 19:17:10 +03:00
|
|
|
" Current revision of repository is: " << svn_latest_revision
|
|
|
|
<< std::endl);
|
2005-07-11 19:16:14 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
2006-03-09 19:17:10 +03:00
|
|
|
" Gathering version information (each . represents one updated file):"
|
|
|
|
<< std::endl);
|
2005-02-16 22:24:43 +03:00
|
|
|
int file_count = 0;
|
2005-07-21 23:54:57 +04:00
|
|
|
std::string removed_line;
|
2006-03-09 19:17:10 +03:00
|
|
|
for ( cc= 0; cc < lines.size(); cc ++ )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
|
|
|
const char* line = lines[cc].c_str();
|
2005-07-21 23:54:57 +04:00
|
|
|
if ( file_removed_line.find(line) )
|
|
|
|
{
|
|
|
|
removed_line = "D " + file_removed_line.match(1);
|
|
|
|
line = removed_line.c_str();
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( file_update_line.find(line) )
|
|
|
|
{
|
2005-06-01 01:32:40 +04:00
|
|
|
if ( file_count == 0 )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << std::flush);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
|
2005-02-16 21:28:47 +03:00
|
|
|
std::string upChar = file_update_line.match(1);
|
|
|
|
std::string upFile = file_update_line.match(2);
|
|
|
|
char mod = upChar[0];
|
2005-04-24 21:57:11 +04:00
|
|
|
bool modifiedOrConflict = false;
|
2006-01-27 19:19:22 +03:00
|
|
|
if ( mod == 'X')
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2005-02-16 22:24:43 +03:00
|
|
|
if ( mod != 'M' && mod != 'C' && mod != 'G' )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
|
|
|
count ++;
|
2005-04-24 21:57:11 +04:00
|
|
|
modifiedOrConflict = true;
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
const char* file = upFile.c_str();
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Line" << cc << ": " << mod << " - "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< file << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2005-04-24 21:57:11 +04:00
|
|
|
std::string output;
|
|
|
|
if ( modifiedOrConflict )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2005-04-24 21:57:11 +04:00
|
|
|
std::string logcommand;
|
|
|
|
switch ( updateType )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-04-24 21:57:11 +04:00
|
|
|
case cmCTestUpdateHandler::e_CVS:
|
|
|
|
logcommand = updateCommand + " -z3 log -N \"" + file + "\"";
|
|
|
|
break;
|
|
|
|
case cmCTestUpdateHandler::e_SVN:
|
2006-03-09 19:17:10 +03:00
|
|
|
if ( svn_latest_revision > 0 &&
|
|
|
|
svn_latest_revision > svn_current_revision )
|
2005-04-24 21:57:11 +04:00
|
|
|
{
|
|
|
|
cmOStringStream logCommandStream;
|
2006-03-09 19:17:10 +03:00
|
|
|
logCommandStream << updateCommand << " log -r "
|
|
|
|
<< svn_current_revision << ":" << svn_latest_revision
|
2005-04-24 21:57:11 +04:00
|
|
|
<< " --xml \"" << file << "\"";
|
|
|
|
logcommand = logCommandStream.str();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
logcommand = updateCommand +
|
|
|
|
" status --verbose \"" + file + "\"";
|
2005-04-24 21:57:11 +04:00
|
|
|
svn_use_status = 1;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Do log: " << logcommand << std::endl);
|
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
2006-03-09 19:17:10 +03:00
|
|
|
"* Get file update information: " << logcommand.c_str()
|
|
|
|
<< std::endl);
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << "* Get log information for file: " << file << std::endl;
|
|
|
|
ofs << " Command: " << logcommand.c_str() << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
res = this->CTest->RunCommand(logcommand.c_str(), &output, &errors,
|
|
|
|
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
|
2005-06-14 19:42:53 +04:00
|
|
|
ofs << " Output: " << output.c_str() << std::endl;
|
|
|
|
ofs << " Errors: " << errors.c_str() << std::endl;
|
2005-04-24 21:57:11 +04:00
|
|
|
if ( ofs )
|
|
|
|
{
|
|
|
|
ofs << output << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-10-13 18:27:01 +04:00
|
|
|
if ( res )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, output << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
std::string::size_type sline = 0;
|
|
|
|
std::string srevision1 = "Unknown";
|
|
|
|
std::string sdate1 = "Unknown";
|
|
|
|
std::string sauthor1 = "Unknown";
|
|
|
|
std::string semail1 = "Unknown";
|
|
|
|
std::string comment1 = "";
|
|
|
|
std::string srevision2 = "Unknown";
|
|
|
|
std::string sdate2 = "Unknown";
|
|
|
|
std::string sauthor2 = "Unknown";
|
|
|
|
std::string comment2 = "";
|
|
|
|
std::string semail2 = "Unknown";
|
|
|
|
if ( updateType == cmCTestUpdateHandler::e_CVS )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
|
|
|
bool have_first = false;
|
|
|
|
bool have_second = false;
|
2005-02-16 21:28:47 +03:00
|
|
|
std::vector<cmStdString> ulines;
|
|
|
|
cmSystemTools::Split(output.c_str(), ulines);
|
2004-09-07 17:17:15 +04:00
|
|
|
for ( kk = 0; kk < ulines.size(); kk ++ )
|
|
|
|
{
|
|
|
|
const char* clp = ulines[kk].c_str();
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( !have_second && !sline && cvs_revision_regex.find(clp) )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
|
|
|
if ( !have_first )
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
srevision1 = cvs_revision_regex.match(1);
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
srevision2 = cvs_revision_regex.match(1);
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
else if ( !have_second && !sline &&
|
|
|
|
cvs_date_author_regex.find(clp) )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
|
|
|
sline = kk + 1;
|
|
|
|
if ( !have_first )
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
sdate1 = cvs_date_author_regex.match(1);
|
|
|
|
sauthor1 = cvs_date_author_regex.match(2);
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
sdate2 = cvs_date_author_regex.match(1);
|
|
|
|
sauthor2 = cvs_date_author_regex.match(2);
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
else if ( sline && cvs_end_of_comment_regex.find(clp) ||
|
|
|
|
cvs_end_of_file_regex.find(clp))
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
|
|
|
if ( !have_first )
|
|
|
|
{
|
|
|
|
have_first = true;
|
|
|
|
}
|
|
|
|
else if ( !have_second )
|
|
|
|
{
|
|
|
|
have_second = true;
|
|
|
|
}
|
|
|
|
sline = 0;
|
|
|
|
}
|
|
|
|
else if ( sline )
|
|
|
|
{
|
|
|
|
if ( !have_first )
|
|
|
|
{
|
|
|
|
comment1 += clp;
|
|
|
|
comment1 += "\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
comment2 += clp;
|
|
|
|
comment2 += "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
else if ( updateType == cmCTestUpdateHandler::e_SVN )
|
|
|
|
{
|
|
|
|
if ( svn_use_status )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
cmOStringStream str;
|
|
|
|
str << svn_current_revision;
|
|
|
|
srevision1 = str.str();
|
|
|
|
if (!svn_status_line_regex.find(output))
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Bad output from SVN status command: " << output
|
|
|
|
<< std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
else if ( svn_status_line_regex.match(4) != file )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Bad output from SVN status command. "
|
|
|
|
"The file name returned: \""
|
|
|
|
<< svn_status_line_regex.match(4)
|
|
|
|
<< "\" was different than the file specified: \"" << file
|
|
|
|
<< "\"" << std::endl);
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
srevision1 = svn_status_line_regex.match(2);
|
2006-03-09 19:17:10 +03:00
|
|
|
int latest_revision = atoi(
|
|
|
|
svn_status_line_regex.match(2).c_str());
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( svn_current_revision < latest_revision )
|
|
|
|
{
|
|
|
|
srevision2 = str.str();
|
|
|
|
}
|
|
|
|
sauthor1 = svn_status_line_regex.match(3);
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
cmCTestUpdateHandlerSVNXMLParser parser(this);
|
|
|
|
if ( parser.Parse(output.c_str()) )
|
|
|
|
{
|
|
|
|
int minrev = parser.GetMinRevision();
|
|
|
|
int maxrev = parser.GetMaxRevision();
|
2006-03-09 19:17:10 +03:00
|
|
|
cmCTestUpdateHandlerSVNXMLParser::
|
|
|
|
t_VectorOfCommits::iterator it;
|
2006-03-10 23:03:09 +03:00
|
|
|
for ( it = parser.GetCommits()->begin();
|
|
|
|
it != parser.GetCommits()->end();
|
2005-02-16 21:28:47 +03:00
|
|
|
++ it )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( it->Revision == maxrev )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
|
|
|
cmOStringStream mRevStream;
|
|
|
|
mRevStream << maxrev;
|
|
|
|
srevision1 = mRevStream.str();
|
2006-03-10 23:03:09 +03:00
|
|
|
sauthor1 = it->Author;
|
|
|
|
comment1 = it->Message;
|
|
|
|
sdate1 = it->Date;
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
else if ( it->Revision == minrev )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
|
|
|
cmOStringStream mRevStream;
|
|
|
|
mRevStream << minrev;
|
|
|
|
srevision2 = mRevStream.str();
|
2006-03-10 23:03:09 +03:00
|
|
|
sauthor2 = it->Author;
|
|
|
|
comment2 = it->Message;
|
|
|
|
sdate2 = it->Date;
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
if ( mod == 'M' )
|
|
|
|
{
|
|
|
|
comment1 = "Locally modified file\n";
|
2005-04-24 21:57:11 +04:00
|
|
|
sauthor1 = "Local User";
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2005-07-22 16:40:16 +04:00
|
|
|
if ( mod == 'D' )
|
2005-07-21 23:54:57 +04:00
|
|
|
{
|
2005-07-22 16:40:16 +04:00
|
|
|
comment1 += " - Removed file\n";
|
2005-07-21 23:54:57 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( mod == 'C' )
|
|
|
|
{
|
|
|
|
comment1 = "Conflict while updating\n";
|
2005-04-24 21:57:11 +04:00
|
|
|
sauthor1 = "Local User";
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
|
|
|
std::string path = cmSystemTools::GetFilenamePath(file);
|
|
|
|
std::string fname = cmSystemTools::GetFilenameName(file);
|
|
|
|
if ( path != current_path )
|
|
|
|
{
|
|
|
|
if ( !first_file )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t</Directory>" << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
first_file = false;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t<Directory>\n"
|
|
|
|
<< "\t\t<Name>" << path << "</Name>" << std::endl;
|
|
|
|
}
|
|
|
|
if ( mod == 'C' )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
numConflicting ++;
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t<Conflicting>" << std::endl;
|
|
|
|
}
|
2005-02-16 22:24:43 +03:00
|
|
|
else if ( mod == 'G' )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
numConflicting ++;
|
2005-02-16 22:24:43 +03:00
|
|
|
os << "\t<Conflicting>" << std::endl;
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
else if ( mod == 'M' )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
numModiefied ++;
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t<Modified>" << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
numUpdated ++;
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t<Updated>" << std::endl;
|
|
|
|
}
|
|
|
|
if ( srevision2 == "Unknown" )
|
|
|
|
{
|
|
|
|
srevision2 = srevision1;
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "File: "
|
|
|
|
<< path.c_str() << " / " << fname.c_str() << " was updated by "
|
2005-06-01 01:32:40 +04:00
|
|
|
<< sauthor1.c_str() << " to revision: " << srevision1.c_str()
|
|
|
|
<< " from revision: " << srevision2.c_str() << std::endl);
|
2006-03-09 19:17:10 +03:00
|
|
|
os << "\t\t<File Directory=\"" << cmCTest::MakeXMLSafe(path) << "\">"
|
|
|
|
<< cmCTest::MakeXMLSafe(fname)
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "</File>\n"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t<Directory>" << cmCTest::MakeXMLSafe(path)
|
|
|
|
<< "</Directory>\n"
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "\t\t<FullName>" << cmCTest::MakeXMLSafe(file) << "</FullName>\n"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t<CheckinDate>" << cmCTest::MakeXMLSafe(sdate1)
|
|
|
|
<< "</CheckinDate>\n"
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor1) << "</Author>\n"
|
|
|
|
<< "\t\t<Email>" << cmCTest::MakeXMLSafe(semail1) << "</Email>\n"
|
|
|
|
<< "\t\t<Log>" << cmCTest::MakeXMLSafe(comment1) << "</Log>\n"
|
|
|
|
<< "\t\t<Revision>" << srevision1 << "</Revision>\n"
|
|
|
|
<< "\t\t<PriorRevision>" << srevision2 << "</PriorRevision>"
|
|
|
|
<< std::endl;
|
|
|
|
if ( srevision2 != srevision1 )
|
|
|
|
{
|
|
|
|
os
|
|
|
|
<< "\t\t<Revisions>\n"
|
|
|
|
<< "\t\t\t<Revision>" << srevision1 << "</Revision>\n"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<PreviousRevision>" << srevision2
|
|
|
|
<< "</PreviousRevision>\n"
|
|
|
|
<< "\t\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor1)
|
|
|
|
<< "</Author>\n"
|
|
|
|
<< "\t\t\t<Date>" << cmCTest::MakeXMLSafe(sdate1)
|
|
|
|
<< "</Date>\n"
|
|
|
|
<< "\t\t\t<Comment>" << cmCTest::MakeXMLSafe(comment1)
|
|
|
|
<< "</Comment>\n"
|
|
|
|
<< "\t\t\t<Email>" << cmCTest::MakeXMLSafe(semail1)
|
|
|
|
<< "</Email>\n"
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "\t\t</Revisions>\n"
|
|
|
|
<< "\t\t<Revisions>\n"
|
|
|
|
<< "\t\t\t<Revision>" << srevision2 << "</Revision>\n"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<PreviousRevision>" << srevision2
|
|
|
|
<< "</PreviousRevision>\n"
|
|
|
|
<< "\t\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor2)
|
|
|
|
<< "</Author>\n"
|
|
|
|
<< "\t\t\t<Date>" << cmCTest::MakeXMLSafe(sdate2)
|
|
|
|
<< "</Date>\n"
|
|
|
|
<< "\t\t\t<Comment>" << cmCTest::MakeXMLSafe(comment2)
|
|
|
|
<< "</Comment>\n"
|
|
|
|
<< "\t\t\t<Email>" << cmCTest::MakeXMLSafe(semail2)
|
|
|
|
<< "</Email>\n"
|
2005-02-16 21:28:47 +03:00
|
|
|
<< "\t\t</Revisions>" << std::endl;
|
|
|
|
}
|
|
|
|
if ( mod == 'C' )
|
|
|
|
{
|
|
|
|
os << "\t</Conflicting>" << std::endl;
|
|
|
|
}
|
2005-02-16 22:24:43 +03:00
|
|
|
else if ( mod == 'G' )
|
|
|
|
{
|
|
|
|
os << "\t</Conflicting>" << std::endl;
|
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
else if ( mod == 'M' )
|
|
|
|
{
|
|
|
|
os << "\t</Modified>" << std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << "\t</Updated>" << std::endl;
|
|
|
|
}
|
|
|
|
cmCTestUpdateHandler::UpdateFiles *u = &authors_files_map[sauthor1];
|
|
|
|
cmCTestUpdateHandler::StringPair p;
|
|
|
|
p.first = path;
|
|
|
|
p.second = fname;
|
|
|
|
u->push_back(p);
|
|
|
|
|
|
|
|
current_path = path;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 22:24:43 +03:00
|
|
|
file_count ++;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2005-02-16 22:24:43 +03:00
|
|
|
if ( file_count )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
|
2005-02-16 22:24:43 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( numUpdated )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numUpdated
|
2006-03-09 19:17:10 +03:00
|
|
|
<< " updated files" << std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( numModiefied )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numModiefied
|
|
|
|
<< " locally modified files"
|
2005-06-01 01:32:40 +04:00
|
|
|
<< std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( numConflicting )
|
2005-02-16 21:28:47 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numConflicting
|
|
|
|
<< " conflicting files"
|
2005-06-01 01:32:40 +04:00
|
|
|
<< std::endl);
|
2005-02-16 21:28:47 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( numModiefied == 0 && numConflicting == 0 && numUpdated == 0 )
|
2005-02-16 22:24:43 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Project is up-to-date"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< std::endl);
|
2005-02-16 22:24:43 +03:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
if ( !first_file )
|
|
|
|
{
|
|
|
|
os << "\t</Directory>" << std::endl;
|
|
|
|
}
|
2004-09-07 17:17:15 +04:00
|
|
|
|
2005-02-16 21:28:47 +03:00
|
|
|
cmCTestUpdateHandler::AuthorsToUpdatesMap::iterator it;
|
|
|
|
for ( it = authors_files_map.begin();
|
|
|
|
it != authors_files_map.end();
|
|
|
|
it ++ )
|
|
|
|
{
|
|
|
|
os << "\t<Author>\n"
|
|
|
|
<< "\t\t<Name>" << it->first << "</Name>" << std::endl;
|
|
|
|
cmCTestUpdateHandler::UpdateFiles *u = &(it->second);
|
|
|
|
for ( cc = 0; cc < u->size(); cc ++ )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t\t<File Directory=\"" << (*u)[cc].first << "\">"
|
|
|
|
<< (*u)[cc].second << "</File>" << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
2005-02-16 21:28:47 +03:00
|
|
|
os << "\t</Author>" << std::endl;
|
2004-09-07 17:17:15 +04:00
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "End" << std::endl);
|
|
|
|
std::string end_time = this->CTest->CurrentTime();
|
2004-09-07 17:17:15 +04:00
|
|
|
os << "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
|
2008-01-30 19:17:36 +03:00
|
|
|
<< "\t<EndTime>" << static_cast<unsigned int>(cmSystemTools::GetTime())
|
|
|
|
<< "</EndTime>\n"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< "<ElapsedMinutes>" <<
|
|
|
|
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
|
2005-04-22 02:23:28 +04:00
|
|
|
<< "</ElapsedMinutes>\n"
|
|
|
|
<< "\t<UpdateReturnStatus>";
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( numModiefied > 0 || numConflicting > 0 )
|
2005-04-22 02:23:28 +04:00
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
os << "Update error: There are modified or conflicting files in the "
|
|
|
|
"repository";
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
" There are modified or conflicting files in the repository"
|
|
|
|
<< std::endl);
|
2005-04-22 02:23:28 +04:00
|
|
|
}
|
2005-04-24 20:32:56 +04:00
|
|
|
if ( updateProducedError )
|
2005-04-22 02:23:28 +04:00
|
|
|
{
|
|
|
|
os << "Update error: ";
|
2006-03-10 23:03:09 +03:00
|
|
|
os << this->CTest->MakeXMLSafe(checkoutErrorMessages);
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, " Update with command: "
|
|
|
|
<< command << " failed" << std::endl);
|
2005-04-22 02:23:28 +04:00
|
|
|
}
|
|
|
|
os << "</UpdateReturnStatus>" << std::endl;
|
|
|
|
os << "</Update>" << std::endl;
|
2005-02-16 21:28:47 +03:00
|
|
|
|
2006-10-13 18:27:01 +04:00
|
|
|
if (! res )
|
2004-09-07 17:17:15 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"Error(s) when updating the project" << std::endl);
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Output: "
|
|
|
|
<< goutput << std::endl);
|
2004-09-07 17:17:15 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|