[Cmake-commits] [cmake-commits] king committed cmCTestSVN.cxx 1.1 1.2 cmCTestSVN.h 1.1 1.2 cmCTestUpdateHandler.cxx 1.58 1.59 cmCTestVC.cxx 1.2 1.3 cmCTestVC.h 1.2 1.3

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 24 12:50:17 EST 2009


Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv25915/Source/CTest

Modified Files:
	cmCTestSVN.cxx cmCTestSVN.h cmCTestUpdateHandler.cxx 
	cmCTestVC.cxx cmCTestVC.h 
Log Message:
ENH: Factor out svn work tree cleanup

This removes work tree cleanup from cmCTestUpdateHandler and adds an
interface for it in cmCTestVC with an implementation in cmCTestSVN.


Index: cmCTestUpdateHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestUpdateHandler.cxx,v
retrieving revision 1.58
retrieving revision 1.59
diff -C 2 -d -r1.58 -r1.59
*** cmCTestUpdateHandler.cxx	24 Feb 2009 15:39:55 -0000	1.58
--- cmCTestUpdateHandler.cxx	24 Feb 2009 17:50:15 -0000	1.59
***************
*** 390,393 ****
--- 390,396 ----
      }
  
+   // Cleanup the working tree.
+   vc->Cleanup();
+ 
    bool res = true;
  
***************
*** 400,445 ****
      break;
    case cmCTestUpdateHandler::e_SVN:
-     command = "\"" + this->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 = "";
-   switch( this->UpdateType )
-     {
-   case cmCTestUpdateHandler::e_CVS:
-     // TODO: CVS - for now just leave empty
-     break;
-   case cmCTestUpdateHandler::e_SVN:
      command = "\"" + this->UpdateCommand + "\" info";
      break;
--- 403,406 ----

Index: cmCTestVC.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestVC.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmCTestVC.h	24 Feb 2009 17:49:57 -0000	1.2
--- cmCTestVC.h	24 Feb 2009 17:50:15 -0000	1.3
***************
*** 40,44 ****
--- 40,49 ----
    void SetSourceDirectory(std::string const& dir);
  
+   /** Perform cleanup operations on the work tree.  */
+   void Cleanup();
+ 
  protected:
+   // Internal API to be implemented by subclasses.
+   virtual void CleanupImpl();
  
    /** Convert a list of arguments to a human-readable command line.  */

Index: cmCTestSVN.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSVN.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmCTestSVN.h	24 Feb 2009 15:39:55 -0000	1.1
--- cmCTestSVN.h	24 Feb 2009 17:50:15 -0000	1.2
***************
*** 31,34 ****
--- 31,38 ----
  
    virtual ~cmCTestSVN();
+ 
+ private:
+   // Implement cmCTestVC internal API.
+   virtual void CleanupImpl();
  };
  

Index: cmCTestSVN.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSVN.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmCTestSVN.cxx	24 Feb 2009 15:39:55 -0000	1.1
--- cmCTestSVN.cxx	24 Feb 2009 17:50:15 -0000	1.2
***************
*** 26,27 ****
--- 26,37 ----
  {
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmCTestSVN::CleanupImpl()
+ {
+   const char* svn = this->CommandLineTool.c_str();
+   const char* svn_cleanup[] = {svn, "cleanup", 0};
+   OutputLogger out(this->Log, "cleanup-out> ");
+   OutputLogger err(this->Log, "cleanup-err> ");
+   this->RunChild(svn_cleanup, &out, &err);
+ }

Index: cmCTestVC.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestVC.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmCTestVC.cxx	24 Feb 2009 17:49:57 -0000	1.2
--- cmCTestVC.cxx	24 Feb 2009 17:50:15 -0000	1.3
***************
*** 71,72 ****
--- 71,86 ----
    return line.str();
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmCTestVC::Cleanup()
+ {
+   this->Log << "--- Begin Cleanup ---\n";
+   this->CleanupImpl();
+   this->Log << "--- End Cleanup ---\n";
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmCTestVC::CleanupImpl()
+ {
+   // We do no cleanup by default.
+ }



More information about the Cmake-commits mailing list