diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-24 17:57:11 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-24 17:57:11 (GMT) |
commit | f3ed1207adb0c05f8d5d42a951c0f0bfeb94ad9e (patch) | |
tree | 0778b1ad169b44d804118796d0f0b48f8b748543 | |
parent | e26bafa52aa8cb6ae9638bd1a890db2b6ef5f67b (diff) | |
download | CMake-f3ed1207adb0c05f8d5d42a951c0f0bfeb94ad9e.zip CMake-f3ed1207adb0c05f8d5d42a951c0f0bfeb94ad9e.tar.gz CMake-f3ed1207adb0c05f8d5d42a951c0f0bfeb94ad9e.tar.bz2 |
ENH: Support for modified and conflicts in subversion
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 109 |
1 files changed, 67 insertions, 42 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 4b0d293..6a73031 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -316,6 +316,10 @@ int cmCTestUpdateHandler::ProcessHandler() int retVal = 0; bool res = true; + + // + // Get initial repository information if that is possible. With subversion, this will check the current revision. + // if ( !command.empty() ) { if ( m_Verbose ) @@ -357,17 +361,9 @@ int cmCTestUpdateHandler::ProcessHandler() } - command = ""; - switch( updateType ) - { - case cmCTestUpdateHandler::e_CVS: - command = updateCommand + " -z3 update " + updateOptions + - " " + extra_update_opts; - break; - case cmCTestUpdateHandler::e_SVN: - command = updateCommand + " update " + updateOptions + - " " + extra_update_opts; - } + // + // Now update repository and remember what files were updated + // cmGeneratedFileStream os; if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Update.xml", os, true) ) { @@ -382,9 +378,31 @@ int cmCTestUpdateHandler::ProcessHandler() } if ( !m_CTest->GetShowOnly() ) { - res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput, - &retVal, sourceDirectory, - m_Verbose, 0 /*m_TimeOut*/); + command = ""; + switch( updateType ) + { + 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 ) { ofs << "--- Update repository ---" << std::endl; @@ -467,46 +485,51 @@ int cmCTestUpdateHandler::ProcessHandler() std::string upChar = file_update_line.match(1); std::string upFile = file_update_line.match(2); char mod = upChar[0]; + bool modifiedOrConflict = false; if ( mod != 'M' && mod != 'C' && mod != 'G' ) { count ++; + modifiedOrConflict = true; } const char* file = upFile.c_str(); //std::cout << "Line" << cc << ": " << mod << " - " << file << std::endl; - std::string logcommand; - switch ( updateType ) + std::string output; + if ( modifiedOrConflict ) { - 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 ) + std::string logcommand; + switch ( updateType ) { - cmOStringStream logCommandStream; - logCommandStream << updateCommand << " log -r " << svn_current_revision << ":" << svn_latest_revision - << " --xml \"" << file << "\""; - logcommand = logCommandStream.str(); + 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; } - else + //std::cout << "Do log: " << logcommand << std::endl; + if ( m_Verbose ) { - logcommand = updateCommand + " status --verbose \"" + file + "\""; - svn_use_status = 1; + 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; } - break; - } - //std::cout << "Do log: " << logcommand << std::endl; - std::string output; - 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) { @@ -647,10 +670,12 @@ int cmCTestUpdateHandler::ProcessHandler() if ( mod == 'M' ) { comment1 = "Locally modified file\n"; + sauthor1 = "Local User"; } if ( mod == 'C' ) { comment1 = "Conflict while updating\n"; + sauthor1 = "Local User"; } std::string path = cmSystemTools::GetFilenamePath(file); std::string fname = cmSystemTools::GetFilenameName(file); |