ENH: Support for modified and conflicts in subversion

This commit is contained in:
Andy Cedilnik 2005-04-24 13:57:11 -04:00
parent e26bafa52a
commit f3ed1207ad

View File

@ -316,6 +316,10 @@ int cmCTestUpdateHandler::ProcessHandler()
int retVal = 0; int retVal = 0;
bool res = true; bool res = true;
//
// Get initial repository information if that is possible. With subversion, this will check the current revision.
//
if ( !command.empty() ) if ( !command.empty() )
{ {
if ( m_Verbose ) if ( m_Verbose )
@ -357,17 +361,9 @@ int cmCTestUpdateHandler::ProcessHandler()
} }
command = ""; //
switch( updateType ) // Now update repository and remember what files were updated
{ //
case cmCTestUpdateHandler::e_CVS:
command = updateCommand + " -z3 update " + updateOptions +
" " + extra_update_opts;
break;
case cmCTestUpdateHandler::e_SVN:
command = updateCommand + " update " + updateOptions +
" " + extra_update_opts;
}
cmGeneratedFileStream os; cmGeneratedFileStream os;
if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Update.xml", os, true) ) if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Update.xml", os, true) )
{ {
@ -382,9 +378,31 @@ int cmCTestUpdateHandler::ProcessHandler()
} }
if ( !m_CTest->GetShowOnly() ) if ( !m_CTest->GetShowOnly() )
{ {
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput, command = "";
&retVal, sourceDirectory, switch( updateType )
m_Verbose, 0 /*m_TimeOut*/); {
case cmCTestUpdateHandler::e_CVS:
command = updateCommand + " -z3 update " + updateOptions +
" " + extra_update_opts;
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
&retVal, sourceDirectory,
m_Verbose, 0 /*m_TimeOut*/);
break;
case cmCTestUpdateHandler::e_SVN:
{
std::string partialOutput;
command = updateCommand + " update " + updateOptions +
" " + extra_update_opts;
res = cmSystemTools::RunSingleCommand(command.c_str(), &partialOutput,
&retVal, sourceDirectory,
m_Verbose, 0 /*m_TimeOut*/);
command = updateCommand + " status";
res = cmSystemTools::RunSingleCommand(command.c_str(), &partialOutput,
&retVal, sourceDirectory,
m_Verbose, 0 /*m_TimeOut*/);
goutput += partialOutput;
}
}
if ( ofs ) if ( ofs )
{ {
ofs << "--- Update repository ---" << std::endl; ofs << "--- Update repository ---" << std::endl;
@ -467,46 +485,51 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string upChar = file_update_line.match(1); std::string upChar = file_update_line.match(1);
std::string upFile = file_update_line.match(2); std::string upFile = file_update_line.match(2);
char mod = upChar[0]; char mod = upChar[0];
bool modifiedOrConflict = false;
if ( mod != 'M' && mod != 'C' && mod != 'G' ) if ( mod != 'M' && mod != 'C' && mod != 'G' )
{ {
count ++; count ++;
modifiedOrConflict = true;
} }
const char* file = upFile.c_str(); const char* file = upFile.c_str();
//std::cout << "Line" << cc << ": " << mod << " - " << file << std::endl; //std::cout << "Line" << cc << ": " << mod << " - " << file << std::endl;
std::string logcommand;
switch ( updateType )
{
case cmCTestUpdateHandler::e_CVS:
logcommand = updateCommand + " -z3 log -N \"" + file + "\"";
break;
case cmCTestUpdateHandler::e_SVN:
if ( svn_latest_revision > 0 && svn_latest_revision > svn_current_revision )
{
cmOStringStream logCommandStream;
logCommandStream << updateCommand << " log -r " << svn_current_revision << ":" << svn_latest_revision
<< " --xml \"" << file << "\"";
logcommand = logCommandStream.str();
}
else
{
logcommand = updateCommand + " status --verbose \"" + file + "\"";
svn_use_status = 1;
}
break;
}
//std::cout << "Do log: " << logcommand << std::endl;
std::string output; std::string output;
if ( m_Verbose ) if ( modifiedOrConflict )
{ {
std::cout << "* Get file update information: " << logcommand.c_str() << std::endl; std::string logcommand;
} switch ( updateType )
res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output, {
&retVal, sourceDirectory, case cmCTestUpdateHandler::e_CVS:
m_Verbose, 0 /*m_TimeOut*/); logcommand = updateCommand + " -z3 log -N \"" + file + "\"";
if ( ofs ) break;
{ case cmCTestUpdateHandler::e_SVN:
ofs << output << std::endl; if ( svn_latest_revision > 0 && svn_latest_revision > svn_current_revision )
{
cmOStringStream logCommandStream;
logCommandStream << updateCommand << " log -r " << svn_current_revision << ":" << svn_latest_revision
<< " --xml \"" << file << "\"";
logcommand = logCommandStream.str();
}
else
{
logcommand = updateCommand + " status --verbose \"" + file + "\"";
svn_use_status = 1;
}
break;
}
//std::cout << "Do log: " << logcommand << std::endl;
if ( m_Verbose )
{
std::cout << "* Get file update information: " << logcommand.c_str() << std::endl;
}
res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
&retVal, sourceDirectory,
m_Verbose, 0 /*m_TimeOut*/);
if ( ofs )
{
ofs << output << std::endl;
}
} }
if ( res && retVal == 0) if ( res && retVal == 0)
{ {
@ -647,10 +670,12 @@ int cmCTestUpdateHandler::ProcessHandler()
if ( mod == 'M' ) if ( mod == 'M' )
{ {
comment1 = "Locally modified file\n"; comment1 = "Locally modified file\n";
sauthor1 = "Local User";
} }
if ( mod == 'C' ) if ( mod == 'C' )
{ {
comment1 = "Conflict while updating\n"; comment1 = "Conflict while updating\n";
sauthor1 = "Local User";
} }
std::string path = cmSystemTools::GetFilenamePath(file); std::string path = cmSystemTools::GetFilenamePath(file);
std::string fname = cmSystemTools::GetFilenameName(file); std::string fname = cmSystemTools::GetFilenameName(file);