cmCTestSVN.h 3.0 KB

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