cmake/Source/CTest/cmCTestSVN.h

105 lines
2.6 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2009-10-04 10:30:41 +03:00
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include <iosfwd>
2018-04-23 21:13:27 +02:00
#include <list>
2016-10-30 18:24:19 +01:00
#include <string>
#include <vector>
2020-02-01 23:06:01 +01:00
#include "cmCTestGlobalVC.h"
2016-10-30 18:24:19 +01:00
class cmCTest;
class cmXMLWriter;
2015-08-17 11:37:30 +02:00
2009-10-04 10:30:41 +03:00
/** \class cmCTestSVN
* \brief Interaction with subversion command-line tool
*
*/
2016-07-09 11:21:54 +02:00
class cmCTestSVN : public cmCTestGlobalVC
2009-10-04 10:30:41 +03:00
{
public:
/** Construct with a CTest instance and update log stream. */
cmCTestSVN(cmCTest* ctest, std::ostream& log);
2018-01-26 17:06:56 +01:00
~cmCTestSVN() override;
2009-10-04 10:30:41 +03:00
private:
// Implement cmCTestVC internal API.
2018-01-26 17:06:56 +01:00
void CleanupImpl() override;
bool NoteOldRevision() override;
bool NoteNewRevision() override;
bool UpdateImpl() override;
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
bool RunSVNCommand(std::vector<char const*> const& parameters,
2016-07-09 11:21:54 +02:00
OutputParser* out, OutputParser* err);
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
// Information about an SVN repository (root repository or external)
2016-07-09 11:21:54 +02:00
struct SVNInfo
{
2009-10-04 10:30:41 +03:00
2019-11-11 23:01:05 +01:00
SVNInfo(std::string const& path = std::string())
2016-07-09 11:21:54 +02:00
: LocalPath(path)
{
}
2013-03-16 19:13:01 +02:00
// Remove base from the filename
std::string BuildLocalPath(std::string const& path) const;
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
// LocalPath relative to the main source directory.
std::string LocalPath;
// URL of repository directory checked out in the working tree.
std::string URL;
// URL of repository root directory.
std::string Root;
// Directory under repository root checked out in working tree.
std::string Base;
// Old and new repository revisions.
std::string OldRevision;
std::string NewRevision;
};
// Extended revision structure to include info about external it refers to.
struct Revision;
2016-10-30 18:24:19 +01:00
2013-03-16 19:13:01 +02:00
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
2018-04-23 21:13:27 +02:00
// Use std::list so the elements don't move in memory.
std::list<SVNInfo> Repositories;
2013-03-16 19:13:01 +02:00
// Pointer to the infos of the root repository.
SVNInfo* RootInfo;
std::string LoadInfo(SVNInfo& svninfo);
2017-07-20 19:35:53 +02:00
bool LoadRepositories();
2018-01-26 17:06:56 +01:00
bool LoadModifications() override;
bool LoadRevisions() override;
2017-07-20 19:35:53 +02:00
bool LoadRevisions(SVNInfo& svninfo);
2009-10-04 10:30:41 +03:00
2016-07-09 11:21:54 +02:00
void GuessBase(SVNInfo& svninfo, std::vector<Change> const& changes);
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
void DoRevisionSVN(Revision const& revision,
std::vector<Change> const& changes);
2009-10-04 10:30:41 +03:00
2018-01-26 17:06:56 +01:00
void WriteXMLGlobal(cmXMLWriter& xml) override;
2010-03-17 14:00:29 +02:00
2016-10-30 18:24:19 +01:00
class ExternalParser;
2009-10-04 10:30:41 +03:00
// Parsing helper classes.
class InfoParser;
class LogParser;
class StatusParser;
class UpdateParser;
2016-10-30 18:24:19 +01:00
2009-10-04 10:30:41 +03:00
friend class InfoParser;
friend class LogParser;
friend class StatusParser;
friend class UpdateParser;
2013-03-16 19:13:01 +02:00
friend class ExternalParser;
2009-10-04 10:30:41 +03:00
};