cmake/Source/CTest/cmCTestSVN.h

106 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. */
2009-10-04 10:30:41 +03:00
#ifndef cmCTestSVN_h
#define cmCTestSVN_h
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h"
2016-10-30 18:24:19 +01:00
2009-10-04 10:30:41 +03:00
#include "cmCTestGlobalVC.h"
2016-10-30 18:24:19 +01:00
#include <iosfwd>
#include <string>
#include <vector>
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);
2016-10-30 18:24:19 +01:00
~cmCTestSVN() CM_OVERRIDE;
2009-10-04 10:30:41 +03:00
private:
// Implement cmCTestVC internal API.
2016-10-30 18:24:19 +01:00
void CleanupImpl() CM_OVERRIDE;
2017-07-20 19:35:53 +02:00
bool NoteOldRevision() CM_OVERRIDE;
bool NoteNewRevision() CM_OVERRIDE;
2016-10-30 18:24:19 +01:00
bool UpdateImpl() CM_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
2016-07-09 11:21:54 +02:00
SVNInfo(const char* path)
: 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).
2017-07-20 19:35:53 +02:00
std::vector<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();
bool LoadModifications() CM_OVERRIDE;
bool LoadRevisions() CM_OVERRIDE;
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
2016-10-30 18:24:19 +01:00
void WriteXMLGlobal(cmXMLWriter& xml) CM_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
};
#endif