|
WSF
|
#include <RevisionDb.hpp>
Public Member Functions | |
| RevisionDb () | |
| virtual | ~RevisionDb () |
| bool | Open (const std::string &aDbPath) |
| bool | OpenInMemory () |
| bool | Close () |
| bool | ClearTables () |
| int | StoreNewRevision (const RevisionChangeList &aChanges, const std::string &aWorkingDir, const std::vector< std::string > &aStartupFiles) |
| int | LatestRevisionNo () |
| int | NewRevisionNo (const std::string &aWorkingDir) |
| bool | DeleteRevision (int aRevNo) |
| bool | GetFileAtRevision (const std::string &aRelFilePath, int aRevision, UtTextDocument &aDoc, int *aRevisionsTraversed=nullptr) |
| bool | InsertChange (int aRevNo, const RevisionChange &aChange) |
| bool | InsertChanges (int aRevNo, const RevisionChangeList &aChangeList) |
| bool | InsertStartupFile (int aRevNo, const std::string &aStartupFile) |
| Inserts a startup file associated with the given revision. | |
| bool | InsertStartupFiles (int aRevNo, const std::vector< std::string > &aStartupFiles) |
| Inserts a list of startup files associated with the given revision. | |
| RevisionList | Revisions () |
| RevisionChangeList | Changes (int aRevNo) |
| RevisionPathSet | ExistingFilePaths (int aRevNo) |
| RevisionPathSet | AllFilePaths (int aRevNo) |
| FileMap | ExistingFiles (int aRevNo) |
| bool | StartupFiles (int aRevNo, std::vector< std::string > &aStartupFiles) |
| bool | WorkingDirectory (int aRevNo, std::string &aWorkingDir) |
| bool | LatestStartupFiles (std::vector< std::string > &aStartupFiles) |
| bool | LatestWorkingDirectory (std::string &aWorkingDir) |
| int | LatestSupportedVersion () const |
| int | Version () |
| bool | IsVersionOld () |
| bool | IsEmpty () |
| bool | IsOpen () const |
A semantic interface into the Change History database for managing revisions, used primarily by ViRevisionStore.
| wizard::RevisionDb::RevisionDb | ( | ) |
|
virtual |
References Close().
| wizard::RevisionPathSet wizard::RevisionDb::AllFilePaths | ( | int | aRevNo | ) |
| aRevNo | A revision number. |
| wizard::RevisionChangeList wizard::RevisionDb::Changes | ( | int | aRevNo | ) |
| aRevNo | A revision number. |
References wizard::RevisionChange::changeBytes, wizard::RevisionChange::cNO_CHANGE, wizard::RevisionChange::filePath, and wizard::RevisionChange::kind.
| bool wizard::RevisionDb::ClearTables | ( | ) |
Runs a transaction that deletes all data from the tables.
References success.
| bool wizard::RevisionDb::Close | ( | ) |
Finalizes the SQLite statements and closes the connection to the database.
References success.
Referenced by ~RevisionDb().
| bool wizard::RevisionDb::DeleteRevision | ( | int | aRevNo | ) |
Deletes a revision from the database. (The deletion will cascade to any associated changes.)
| aRevNo | The revision number to delete. |
| wizard::RevisionPathSet wizard::RevisionDb::ExistingFilePaths | ( | int | aRevNo | ) |
| aRevNo | A revision number. |
Referenced by ExistingFiles().
| wizard::FileMap wizard::RevisionDb::ExistingFiles | ( | int | aRevNo | ) |
| aRevNo | A revision number. |
References ExistingFilePaths(), and GetFileAtRevision().
Referenced by wizard::ExportFiles::ExportRevision().
| bool wizard::RevisionDb::GetFileAtRevision | ( | const std::string & | aRelFilePath, |
| int | aRevision, | ||
| UtTextDocument & | aDoc, | ||
| int * | aRevisionsTraversed = nullptr ) |
Retrieves the version of a given file as it existed at a given revision. This is used for restoring files to old versions.
| aRelFilePath | The relative path of the file to look up in the database. |
| aRevision | The revision of the file to fetch. |
| aDoc | A reference to a document object to which the content of the given file name at the given revision will be written. |
| aRevisionsTraversed | The number of revisions that needed to be traversed in order to build the file contents. |
References wizard::ApplyToDocument(), wizard::RevisionChange::cCHANGE_DELTA, wizard::RevisionChange::cCHANGE_FULL, wizard::RevisionChange::cNEW_FILE, and wizard::RevisionChange::cREMOVED_FILE.
Referenced by ExistingFiles().
| bool wizard::RevisionDb::InsertChange | ( | int | aRevNo, |
| const RevisionChange & | aChange ) |
Inserts a change for a given revision into the database.
| aRevNo | The revision number that the change belongs to. |
| aChange | The change to insert. |
References wizard::RevisionChange::changeBytes, wizard::RevisionChange::filePath, InsertChange(), and wizard::RevisionChange::kind.
Referenced by InsertChange(), and InsertChanges().
| bool wizard::RevisionDb::InsertChanges | ( | int | aRevNo, |
| const RevisionChangeList & | aChangeList ) |
Inserts a list of changes for a given revision into the database.
| aRevNo | The revision number that the changes belong to. |
| aChangeList | The list of changes to insert. |
References InsertChange(), and success.
Referenced by StoreNewRevision().
| bool wizard::RevisionDb::InsertStartupFile | ( | int | aRevNo, |
| const std::string & | aStartupFile ) |
Inserts a startup file associated with the given revision.
Referenced by InsertStartupFiles().
| bool wizard::RevisionDb::InsertStartupFiles | ( | int | aRevNo, |
| const std::vector< std::string > & | aStartupFiles ) |
Inserts a list of startup files associated with the given revision.
References InsertStartupFile(), and success.
Referenced by StoreNewRevision().
| bool wizard::RevisionDb::IsEmpty | ( | ) |
References LatestRevisionNo().
| bool wizard::RevisionDb::IsOpen | ( | ) | const |
| bool wizard::RevisionDb::IsVersionOld | ( | ) |
References LatestSupportedVersion(), and Version().
| int wizard::RevisionDb::LatestRevisionNo | ( | ) |
Referenced by IsEmpty(), LatestStartupFiles(), LatestWorkingDirectory(), and NewRevisionNo().
| bool wizard::RevisionDb::LatestStartupFiles | ( | std::vector< std::string > & | aStartupFiles | ) |
References LatestRevisionNo(), and StartupFiles().
Referenced by StoreNewRevision().
| int wizard::RevisionDb::LatestSupportedVersion | ( | ) | const |
Referenced by IsVersionOld().
| bool wizard::RevisionDb::LatestWorkingDirectory | ( | std::string & | aWorkingDir | ) |
References LatestRevisionNo(), and WorkingDirectory().
Referenced by StoreNewRevision().
| int wizard::RevisionDb::NewRevisionNo | ( | const std::string & | aWorkingDir | ) |
Creates a new revision number.
References LatestRevisionNo().
Referenced by StoreNewRevision().
| bool wizard::RevisionDb::Open | ( | const std::string & | aDbPath | ) |
Creates and/or opens a database at the given file path.
| aDbPath | The file path of the database to open. |
References success, and Version().
Referenced by OpenInMemory().
| bool wizard::RevisionDb::OpenInMemory | ( | ) |
SQLite will create an in-memory database when opening a database with the special name ":memory:". The database will vanish when its connection closes. Particularly useful for tests.
References Open().
| wizard::RevisionList wizard::RevisionDb::Revisions | ( | ) |
References wizard::Revision::startupFiles.
| bool wizard::RevisionDb::StartupFiles | ( | int | aRevNo, |
| std::vector< std::string > & | aStartupFiles ) |
Referenced by LatestStartupFiles().
| int wizard::RevisionDb::StoreNewRevision | ( | const RevisionChangeList & | aChanges, |
| const std::string & | aWorkingDir, | ||
| const std::vector< std::string > & | aStartupFiles ) |
Stores a new revision of changes in the database.
| aChanges | The list of file changes to insert for the new revision. |
| aWorkingDir | The project working directory to insert for the new revision. |
| aStartupFiles | The list of project startup files to insert for the new revision. |
References InsertChanges(), InsertStartupFiles(), LatestStartupFiles(), LatestWorkingDirectory(), and NewRevisionNo().
| int wizard::RevisionDb::Version | ( | ) |
This should not be used in the same way the other statements are used with ViSqlStmt objects. The version specifically will have to be checked before initializing all the other statements, so that the database can be upgraded from earlier versions if necessary.
References wizard::RevisionSqlStmt::Bind(), wizard::RevisionSqlStmt::ColInt(), wizard::RevisionSqlStmt::Finalize(), wizard::RevisionSqlStmt::Prepare(), wizard::RevisionSqlStmt::Reset(), and wizard::RevisionSqlStmt::Step().
Referenced by IsVersionOld(), and Open().
| bool wizard::RevisionDb::WorkingDirectory | ( | int | aRevNo, |
| std::string & | aWorkingDir ) |
Sets the reference aWorkingDir to the working directory of the given revision number.
Referenced by LatestWorkingDirectory().