diff options
author | Brad King <brad.king@kitware.com> | 2009-02-25 19:42:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-02-25 19:42:45 (GMT) |
commit | 80282b749fb138ea8bd188dd5b7623c7545ea927 (patch) | |
tree | a654e1b28bf2b2bec97de9ee7dad695d322598f1 /Source/CTest/cmCTestSVN.h | |
parent | cb788e8f6dfeeb5a934679f671adc87116837834 (diff) | |
download | CMake-80282b749fb138ea8bd188dd5b7623c7545ea927.zip CMake-80282b749fb138ea8bd188dd5b7623c7545ea927.tar.gz CMake-80282b749fb138ea8bd188dd5b7623c7545ea927.tar.bz2 |
ENH: Rewrite CTest Update implementation
This adds a new VCS update implementation to the cmCTestVC hierarchy and
removes it from cmCTestUpdateHandler. The new implementation has the
following advantages:
- Factorized implementation instead of monolithic function
- Logs vcs tool output as it is parsed (less memory, inline messages)
- Uses one global svn log instead of one log per file
- Reports changes on cvs branches (instead of latest trunk change)
- Generates simpler Update.xml (only one Directory element per dir)
Shared components of the new implementation appear in cmCTestVC and may
be re-used by subclasses for other VCS tools in the future.
Diffstat (limited to 'Source/CTest/cmCTestSVN.h')
-rw-r--r-- | Source/CTest/cmCTestSVN.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index af14cf0..32b472d 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -31,13 +31,25 @@ public: virtual ~cmCTestSVN(); - int GetOldRevision() { return atoi(this->OldRevision.c_str()); } - int GetNewRevision() { return atoi(this->NewRevision.c_str()); } private: // Implement cmCTestVC internal API. virtual void CleanupImpl(); virtual void NoteOldRevision(); virtual void NoteNewRevision(); + virtual bool UpdateImpl(); + virtual bool WriteXMLUpdates(std::ostream& xml); + + /** Represent a subversion-reported action for one path in a revision. */ + struct Change + { + char Action; + std::string Path; + Change(): Action('?') {} + }; + + // Update status for files in each directory. + class Directory: public std::map<cmStdString, File> {}; + std::map<cmStdString, Directory> Dirs; // Old and new repository revisions. std::string OldRevision; @@ -52,11 +64,33 @@ private: // Directory under repository root checked out in working tree. std::string Base; + // Information known about old revision. + Revision PriorRev; + + // Information about revisions from a svn log. + std::list<Revision> Revisions; + std::string LoadInfo(); + void LoadModifications(); + void LoadRevisions(); + + void GuessBase(std::vector<Change> const& changes); + const char* LocalPath(std::string const& path); + + void DoRevision(Revision const& revision, + std::vector<Change> const& changes); + void WriteXMLDirectory(std::ostream& xml, std::string const& path, + Directory const& dir); // Parsing helper classes. class InfoParser; + class LogParser; + class StatusParser; + class UpdateParser; friend class InfoParser; + friend class LogParser; + friend class StatusParser; + friend class UpdateParser; }; #endif |