CFx SDK Documentation 2024 SP0
|
#include <TfRevisionControl.h>
Protected Member Functions | |
void | makePatch (OdStreamBuf *s, const OdTfDigestArray &from, const OdTfDigestArray &to, const OdTfRevisionControl::ReferenceList &refs) const |
Protected Attributes | |
OdTfStorageImpl * | m_pImpl |
Friends | |
struct | OdTfStorageImpl |
void | OdTfRevisionControl::beginPartialImport (OdStreamBufPtr pStream, OdDbDatabase *pDb) |
Additional Inherited Members | |
Static Public Member Functions inherited from OdRxObject | |
static OdRxObjectPtr | cast (const OdRxObject *pointer) |
static OdRxClass * | desc () |
This structure represents the low level storage of drawing revisions.
Definition at line 604 of file TfRevisionControl.h.
OdTfStorage::OdTfStorage | ( | ) |
Creates a new instance of the OdTfStorage object with default parameters.
OdTfStorage::~OdTfStorage | ( | ) |
Destroys the OdTfStorage object.
void OdTfStorage::applyPatch | ( | OdStreamBuf * | s, |
OdTfDigestArray & | roots, | ||
OdTfRevisionControl::ReferenceList & | refs | ||
) |
Applies a patch created by makePatch() on a storage to get all the changes contained in the patch file transfered to the storage.
s | [in] Stream buffer associated with the patch file. |
roots | [out] Set of root objects created by the patch (makePatch() "to" parameter). |
refs | [out] Set of references included in the patch. These won't be set on the storage yet and thus require further processing. |
OdTfDigest OdTfStorage::applySchemePatch | ( | OdStreamBufPtr & | schemePatch | ) | const |
Write in to OdTfStorage schemes
schemePatch | [in] patch with scheme that created by OdTfStorage::makeSchemePatch(OdTfDigest). |
void OdTfStorage::dryMerge | ( | const OdDbDatabase * | pDb, |
const OdTfDigest & | theirs, | ||
const OdTfDigest & | base, | ||
OdTfMergeHandler & | mergeHandler | ||
) | const |
void OdTfStorage::dryMerge | ( | const OdTfDigest & | mine, |
const OdTfDigest & | theirs, | ||
const OdTfDigest & | base, | ||
OdTfMergeHandler & | mergeHandler | ||
) | const |
Dry merge operation for calculating all the changes and conflicts.
Does not perform any real merge operation. Only useful for recording/inspecting callbacks to mergeHandler in order to have the full picture before performing the actual merge operation. The return value of the mergeHandler is ignored.
mine | [in] Revision to be used as my side for the merge. |
pDb | [in] The database to be used as my side for the merge. |
theirs | [in] Revision to be used as their side for merge. |
base | [in] Common ancestor revision for my and their side. |
mergeHandler | [in] Callback for recording/inspecting all changes. |
bool OdTfStorage::getReference | ( | const OdString & | refName, |
OdTfDigest & | sha | ||
) | const |
Returns the hash of the specified branch.
refName | [in] Branch name. |
sha | [out] Hash code of the branch head commit. |
void OdTfStorage::getReferences | ( | OdTfRevisionControl::ReferenceList & | refs | ) | const |
Gets a set of branch names and their hashes from the repository.
refs | [out] Container with branches and their hashes of commit. |
void OdTfStorage::getRevisionDifference | ( | const OdTfDigest & | newRevision, |
const OdTfDigest & | oldRevision, | ||
OdTfRevisionControl::ChangeList & | result | ||
) | const |
Gets a list of handles of the objects that differ between revisions. Revisions may actually be unrelated.
newRevision | [in] Hash code of the first revision. |
oldRevision | [in] Hash code of the second revision. |
result | [out] A list of changes, containing IDs of objects that differ between revisions. |
void OdTfStorage::getRevisionDifference | ( | OdDbDatabase * | pDb, |
const OdTfDigest & | revision, | ||
OdTfRevisionControl::ChangeList & | result | ||
) | const |
Gets a list of handles of the objects that differ between a revision and the database.
pDb | [in] A database to compare with. |
revision | [in] Hash code of the revision. |
result | [out] A list of changes, containing IDs of objects that differ between the database and the revision. |
OdStreamBufPtr OdTfStorage::getStorageStream | ( | ) | const |
Retrieves the stream associated with the storage.
bool OdTfStorage::isSchemePresent | ( | const OdTfDigest & | sha | ) | const |
Checks for the required schema for this revision.
sha | [in] Source revision to check scheme |
OdStreamBufPtr OdTfStorage::makePatch | ( | const OdTfDigestArray & | from, |
const OdTfDigestArray & | to, | ||
const OdTfRevisionControl::ReferenceList & | refs = OdTfRevisionControl::ReferenceList() |
||
) | const |
Collects all the changes since the "from" set of revisions to the "to" set of revisions. Together with applyPatch() it is designed to transfer changes between storages.
The "from" set of revisions is considered available in the remote storage. So, the objects reachable by these commits should not be included in the patch. The "to" set of revisions are the revisions that need to be made available on the remote. Each names a single revision to be included. So, if all revisions of a branch need to be included, then each revision from that branch needs to included in the "to" set.
Consider following example scenarios:
Remote: – C7 / C0 – C1 – C2 -----— C5 – C6 \ / ^ – C3 – C4 – master
Local: master v C0 – C1 – C2 \ – C3 ^ branch1
If the local storage has revision C3 and wants to update to head of master, it makes a request to the remote 'update({C3}, {master})' which is translated on the remote to 'makePatch({C3}, {C6})'. This will only include the differences between revision C3 and revision C6 into the patch.
If the local repository has two branches up to C2, C3 (C0, C1, C2, C3) and wants to pull the remote changes up to C6, it makes a request to the remote 'pull({C2, C3}, master)' which is translated on the remote to 'makePatch({C0, C1, C2, C3}, {C4, C5, C6})'. This will include all objects from C4, C5 and C6 in the patch not already available in any of the local branches.
This can also be used for the initial clone of a repository by making a request to the remote 'pull({}, master)' which is thus translated to 'makePatch({}, {C0, C1, C2, C3, C4, C5, C6})' which does not include C7 or 'update({}, {master})' which only includes all objects for C6 in the patch.
from | [in] Set of revision hashes for the starting revisions. |
to | [in] Set of revision hashes for the ending revisions. |
refs | [in] Set of references to be included in the patch. |
|
protected |
OdStreamBufPtr OdTfStorage::makeSchemePatch | ( | const OdTfDigest & | sha | ) | const |
Create the scheme patch of specific revision
sha | [in] the revision for which the schema patch will be created |
OdDbDatabasePtr OdTfStorage::merge | ( | const OdTfDigest & | mine, |
const OdTfDigest & | theirs, | ||
const OdTfDigest & | base, | ||
OdTfMergeHandler & | mergeHandler | ||
) | const |
Merges changes from the repository to the database. Merge operation does not automatically saves the changes, only runtime database is changed.
The mine revision will be retrieve from storage and used as a target database for the merge. It will be returned as the result database (which is not yet stored to the storage).
mine | [in] Revision to be used as my side for the merge. |
theirs | [in] Revision to be used as their side for the merge. |
base | [in] Common ancestor revision for my and their side. |
mergeHandler | [in/out] Callback for handling merge conflicts. |
void OdTfStorage::merge | ( | OdDbDatabase * | pDb, |
const OdTfDigest & | theirs, | ||
const OdTfDigest & | base, | ||
OdTfMergeHandler & | mergeHandler | ||
) | const |
Merges changes from the repository and database. Merge operation does not automatically saves the changes, only runtime database is changed.
The database passes as my side will be used as the target database for the merge. The object changes will be calculated from this database compared to the base revision.
pDb | [in/out] A database to merge into. This database is used as my side for the merge. |
theirs | [in] Revision to be used as their side for the merge. |
base | [in] Common ancestor revision for my and their side. |
mergeHandler | [in/out] Callback for handling merge conflicts. |
OdDbDatabasePtr OdTfStorage::retrieve | ( | const OdTfDigest & | sha, |
bool | partial = false |
||
) | const |
Retrieves a drawing database from the storage. The database is checked out from a specific revision from the storage. If "partial" is false, all the objects are loaded in memory. If they will be eventually loaded anyway, it is much faster not to set "partial" flag to true.
sha | [in] Source revision to check out a database from. |
partial | [in] Flag that determines whether all the objects are loaded in memory (false) or not (true). |
void OdTfStorage::setReference | ( | const OdString & | refName, |
const OdTfDigest & | sha | ||
) |
Writes a branch with its hash.
refName | [in] Branch name. |
sha | [in] Commit hash. |
void OdTfStorage::setReference | ( | const OdTfRevisionControl::ReferenceList & | branches | ) |
Writes a set of branches with their hashes.
branches | [in] Hash of commit. |
OdTfDigest OdTfStorage::store | ( | OdDbDatabase * | pDb, |
const OdDbObjectIdArray * | objectsToSave = 0 |
||
) |
Open an existing .dsf storage or create a new .dsf storage without history tracking.
pStream | [in] Stream, associated with the storage. |
pHostApp | [in] Platform specific host application services. |
Stores a .dwg database into the .dsf storage. Can be used for both the initial import in the repository or for integrating changes made by third party editors.
The returned hash is the only way to access the stored revision of the drawing. There is no way to retrieve the hash of an existing revision, as such the hash should be stored by other external means.
pDb | [in] Database to be stored in the storage. |
objectsToSave | [in] List of objects to be saved. Optional. Used to perform a partial revision. |
|
friend |
|
friend |
Definition at line 881 of file TfRevisionControl.h.
|
protected |
Definition at line 883 of file TfRevisionControl.h.