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() )
{ {
command = "";
switch( updateType )
{
case cmCTestUpdateHandler::e_CVS:
command = updateCommand + " -z3 update " + updateOptions +
" " + extra_update_opts;
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput, res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
&retVal, sourceDirectory, &retVal, sourceDirectory,
m_Verbose, 0 /*m_TimeOut*/); 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,13 +485,18 @@ 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 output;
if ( modifiedOrConflict )
{
std::string logcommand; std::string logcommand;
switch ( updateType ) switch ( updateType )
{ {
@ -496,7 +519,6 @@ int cmCTestUpdateHandler::ProcessHandler()
break; break;
} }
//std::cout << "Do log: " << logcommand << std::endl; //std::cout << "Do log: " << logcommand << std::endl;
std::string output;
if ( m_Verbose ) if ( m_Verbose )
{ {
std::cout << "* Get file update information: " << logcommand.c_str() << std::endl; std::cout << "* Get file update information: " << logcommand.c_str() << std::endl;
@ -508,6 +530,7 @@ int cmCTestUpdateHandler::ProcessHandler()
{ {
ofs << output << std::endl; ofs << output << std::endl;
} }
}
if ( res && retVal == 0) if ( res && retVal == 0)
{ {
//std::cout << output << std::endl; //std::cout << output << std::endl;
@ -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);