1
0

cmCTestSVN.h 2.6 KB

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