cmCTestSVN.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc.
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCTestSVN_h
  11. #define cmCTestSVN_h
  12. #include "cmCTestGlobalVC.h"
  13. /** \class cmCTestSVN
  14. * \brief Interaction with subversion command-line tool
  15. *
  16. */
  17. class cmCTestSVN: public cmCTestGlobalVC
  18. {
  19. public:
  20. /** Construct with a CTest instance and update log stream. */
  21. cmCTestSVN(cmCTest* ctest, std::ostream& log);
  22. virtual ~cmCTestSVN();
  23. private:
  24. // Implement cmCTestVC internal API.
  25. virtual void CleanupImpl();
  26. virtual void NoteOldRevision();
  27. virtual void NoteNewRevision();
  28. virtual bool UpdateImpl();
  29. bool RunSVNCommand(std::vector<char const*> const& parameters,
  30. OutputParser* out, OutputParser* err);
  31. // Information about an SVN repository (root repository or external)
  32. struct SVNInfo {
  33. SVNInfo(const char* path) : LocalPath(path) {}
  34. // Remove base from the filename
  35. std::string BuildLocalPath(std::string const& path) const;
  36. // LocalPath relative to the main source directory.
  37. std::string LocalPath;
  38. // URL of repository directory checked out in the working tree.
  39. std::string URL;
  40. // URL of repository root directory.
  41. std::string Root;
  42. // Directory under repository root checked out in working tree.
  43. std::string Base;
  44. // Old and new repository revisions.
  45. std::string OldRevision;
  46. std::string NewRevision;
  47. };
  48. // Extended revision structure to include info about external it refers to.
  49. struct Revision;
  50. friend struct Revision;
  51. // Info of all the repositories (root, externals and nested ones).
  52. std::list<SVNInfo> Repositories;
  53. // Pointer to the infos of the root repository.
  54. SVNInfo* RootInfo;
  55. std::string LoadInfo(SVNInfo& svninfo);
  56. void LoadExternals();
  57. void LoadModifications();
  58. void LoadRevisions();
  59. void LoadRevisions(SVNInfo& svninfo);
  60. void GuessBase(SVNInfo &svninfo, std::vector<Change> const& changes);
  61. void DoRevisionSVN(Revision const& revision,
  62. std::vector<Change> const& changes);
  63. void WriteXMLGlobal(std::ostream& xml);
  64. // Parsing helper classes.
  65. class InfoParser;
  66. class LogParser;
  67. class StatusParser;
  68. class UpdateParser;
  69. class ExternalParser;
  70. friend class InfoParser;
  71. friend class LogParser;
  72. friend class StatusParser;
  73. friend class UpdateParser;
  74. friend class ExternalParser;
  75. };
  76. #endif