cmCTestSVN.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #include <list>
  14. /** \class cmCTestSVN
  15. * \brief Interaction with subversion command-line tool
  16. *
  17. */
  18. class cmCTestSVN : public cmCTestGlobalVC
  19. {
  20. public:
  21. /** Construct with a CTest instance and update log stream. */
  22. cmCTestSVN(cmCTest* ctest, std::ostream& log);
  23. ~cmCTestSVN() CM_OVERRIDE;
  24. private:
  25. // Implement cmCTestVC internal API.
  26. void CleanupImpl() CM_OVERRIDE;
  27. void NoteOldRevision() CM_OVERRIDE;
  28. void NoteNewRevision() CM_OVERRIDE;
  29. bool UpdateImpl() CM_OVERRIDE;
  30. bool RunSVNCommand(std::vector<char const*> const& parameters,
  31. OutputParser* out, OutputParser* err);
  32. // Information about an SVN repository (root repository or external)
  33. struct SVNInfo
  34. {
  35. SVNInfo(const char* path)
  36. : LocalPath(path)
  37. {
  38. }
  39. // Remove base from the filename
  40. std::string BuildLocalPath(std::string const& path) const;
  41. // LocalPath relative to the main source directory.
  42. std::string LocalPath;
  43. // URL of repository directory checked out in the working tree.
  44. std::string URL;
  45. // URL of repository root directory.
  46. std::string Root;
  47. // Directory under repository root checked out in working tree.
  48. std::string Base;
  49. // Old and new repository revisions.
  50. std::string OldRevision;
  51. std::string NewRevision;
  52. };
  53. // Extended revision structure to include info about external it refers to.
  54. struct Revision;
  55. friend struct Revision;
  56. // Info of all the repositories (root, externals and nested ones).
  57. std::list<SVNInfo> Repositories;
  58. // Pointer to the infos of the root repository.
  59. SVNInfo* RootInfo;
  60. std::string LoadInfo(SVNInfo& svninfo);
  61. void LoadExternals();
  62. void LoadModifications() CM_OVERRIDE;
  63. void LoadRevisions() CM_OVERRIDE;
  64. void LoadRevisions(SVNInfo& svninfo);
  65. void GuessBase(SVNInfo& svninfo, std::vector<Change> const& changes);
  66. void DoRevisionSVN(Revision const& revision,
  67. std::vector<Change> const& changes);
  68. void WriteXMLGlobal(cmXMLWriter& xml) CM_OVERRIDE;
  69. // Parsing helper classes.
  70. class InfoParser;
  71. class LogParser;
  72. class StatusParser;
  73. class UpdateParser;
  74. class ExternalParser;
  75. friend class InfoParser;
  76. friend class LogParser;
  77. friend class StatusParser;
  78. friend class UpdateParser;
  79. friend class ExternalParser;
  80. };
  81. #endif