cmCTestSVN.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 <list>
  9. #include <string>
  10. #include <vector>
  11. class cmCTest;
  12. class cmXMLWriter;
  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. ~cmCTestSVN() override;
  23. private:
  24. // Implement cmCTestVC internal API.
  25. void CleanupImpl() override;
  26. bool NoteOldRevision() override;
  27. bool NoteNewRevision() override;
  28. bool UpdateImpl() override;
  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. {
  34. SVNInfo(const char* path)
  35. : LocalPath(path)
  36. {
  37. }
  38. // Remove base from the filename
  39. std::string BuildLocalPath(std::string const& path) const;
  40. // LocalPath relative to the main source directory.
  41. std::string LocalPath;
  42. // URL of repository directory checked out in the working tree.
  43. std::string URL;
  44. // URL of repository root directory.
  45. std::string Root;
  46. // Directory under repository root checked out in working tree.
  47. std::string Base;
  48. // Old and new repository revisions.
  49. std::string OldRevision;
  50. std::string NewRevision;
  51. };
  52. // Extended revision structure to include info about external it refers to.
  53. struct Revision;
  54. friend struct Revision;
  55. // Info of all the repositories (root, externals and nested ones).
  56. // Use std::list so the elements don't move in memory.
  57. std::list<SVNInfo> Repositories;
  58. // Pointer to the infos of the root repository.
  59. SVNInfo* RootInfo;
  60. std::string LoadInfo(SVNInfo& svninfo);
  61. bool LoadRepositories();
  62. bool LoadModifications() override;
  63. bool LoadRevisions() override;
  64. bool 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) override;
  69. class ExternalParser;
  70. // Parsing helper classes.
  71. class InfoParser;
  72. class LogParser;
  73. class StatusParser;
  74. class UpdateParser;
  75. friend class InfoParser;
  76. friend class LogParser;
  77. friend class StatusParser;
  78. friend class UpdateParser;
  79. friend class ExternalParser;
  80. };
  81. #endif