CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
OdTfRepository Class Reference

#include <TfRevisionControl.h>

Inheritance diagram for OdTfRepository:
OdTfStorage OdRxObject

Public Member Functions

void init (const bool isNewStorage)
 
OdTfDigest commit (OdDbDatabase *pDb, const OdTfDigestArray &parents, const OdTfCommitAnnotation &message=OdTfCommitAnnotation(), const OdDbObjectIdArray *objectsToSave=0)
 
OdTfDigest import (OdDbDatabase *pDb, const OdString &localbranch)
 
OdDbDatabasePtr checkout (const OdTfDigest &sha, const OdString &localBranch, bool partial=false)
 
OdDbDatabasePtr checkout (const OdString &reference, const OdString &localBranch, bool partial=false)
 
OdDbDatabasePtr checkout (const OdString &branch, bool partial=false)
 
OdStreamBufPtr makePatch (const OdTfDigestArray &from, const OdTfDigestArray &to, const OdTfRevisionControl::ReferenceList &refs=OdTfRevisionControl::ReferenceList()) const
 
OdStreamBufPtr makePatch (const OdTfDigestArray &from, const OdTfDigest &to, const OdTfRevisionControl::ReferenceList &refs=OdTfRevisionControl::ReferenceList()) const
 
OdTfCommitInfo getCommitInfo (const OdTfDigest &sha) const
 
OdTfDigest writeCommitInfo (OdTfCommitInfo &commitInfo)
 
- Public Member Functions inherited from OdTfStorage
 OdTfStorage ()
 
 ~OdTfStorage ()
 
OdTfDigest store (OdDbDatabase *pDb, const OdDbObjectIdArray *objectsToSave=0)
 
OdDbDatabasePtr retrieve (const OdTfDigest &sha, bool partial=false) const
 
bool isSchemePresent (const OdTfDigest &sha) const
 
OdStreamBufPtr makeSchemePatch (const OdTfDigest &sha) const
 
OdTfDigest applySchemePatch (OdStreamBufPtr &schemePatch) const
 
void dryMerge (const OdTfDigest &mine, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
void dryMerge (const OdDbDatabase *pDb, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
OdDbDatabasePtr merge (const OdTfDigest &mine, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
void merge (OdDbDatabase *pDb, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
OdStreamBufPtr makePatch (const OdTfDigestArray &from, const OdTfDigestArray &to, const OdTfRevisionControl::ReferenceList &refs=OdTfRevisionControl::ReferenceList()) const
 
void applyPatch (OdStreamBuf *s, OdTfDigestArray &roots, OdTfRevisionControl::ReferenceList &refs)
 
void getRevisionDifference (const OdTfDigest &newRevision, const OdTfDigest &oldRevision, OdTfRevisionControl::ChangeList &result) const
 
void getRevisionDifference (OdDbDatabase *pDb, const OdTfDigest &revision, OdTfRevisionControl::ChangeList &result) const
 
OdStreamBufPtr getStorageStream () const
 
void setReference (const OdString &refName, const OdTfDigest &sha)
 
void setReference (const OdTfRevisionControl::ReferenceList &branches)
 
bool getReference (const OdString &refName, OdTfDigest &sha) const
 
void getReferences (OdTfRevisionControl::ReferenceList &refs) const
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
virtual void addRef ()=0
 
virtual void release ()=0
 
virtual long numRefs () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual void copyFrom (const OdRxObject *pSource)
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Static Public Member Functions

static OdTfRepositoryPtr createObject (OdStreamBufPtr pStream, OdDbHostAppServices *pHostApp)
 
- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 

Additional Inherited Members

- Protected Member Functions inherited from OdTfStorage
void makePatch (OdStreamBuf *s, const OdTfDigestArray &from, const OdTfDigestArray &to, const OdTfRevisionControl::ReferenceList &refs) const
 
- Protected Attributes inherited from OdTfStorage
OdTfStorageImplm_pImpl
 

Detailed Description

Storage of drawing revisions with history tracking. Drawing databases checked out from this repository will have check out tracking information associated with it (branch tracking, parent commit, merge tracking, etc.).

Definition at line 891 of file TfRevisionControl.h.

Member Function Documentation

◆ checkout() [1/3]

OdDbDatabasePtr OdTfRepository::checkout ( const OdString branch,
bool  partial = false 
)

Convenience checkout() method using a branch for both as source and as current branch for commits.

Parameters
branch[in] Branch for both source and to be set as current for commits.
partial[in] Flag that determines whether all the objects are loaded in memory (false) or not (true).
Returns
Pointer to the database corresponding to a checked out state.

◆ checkout() [2/3]

OdDbDatabasePtr OdTfRepository::checkout ( const OdString reference,
const OdString localBranch,
bool  partial = false 
)

Convenience checkout() method using a reference as a source.

Parameters
reference[in] Source branch to check out a database from.
localBranch[in] Branch to be set as current for commits.
partial[in] Flag that determines whether all the objects are loaded in memory (false) or not (true).
Returns
Pointer to the database corresponding to a checked out state.

◆ checkout() [3/3]

OdDbDatabasePtr OdTfRepository::checkout ( const OdTfDigest sha,
const OdString localBranch,
bool  partial = false 
)

Reads a database from the repository. The database is checked out from a specific revision from the repository. A "localBranch" sets a default branch for commit. If "localBranch" is an empty string, the database will be detached from any branch. 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.

Parameters
sha[in] Source commit to check out a database from.
localBranch[in] Branch to be set as current for commits.
partial[in] Flag that determines whether all the objects are loaded in memory (false) or not (true).
Returns
Pointer to the database corresponding to the checked out state.

◆ commit()

OdTfDigest OdTfRepository::commit ( OdDbDatabase pDb,
const OdTfDigestArray parents,
const OdTfCommitAnnotation message = OdTfCommitAnnotation(),
const OdDbObjectIdArray objectsToSave = 0 
)

Commit a .dwg database into the .dsf repository. Can be used for both the initial import in the repository or for integrating changes made by third party editors.

The parameter "parents" specifies the parent commits for which this database state is considered the next revision. "Parents" is empty for an initial commit, contains a single commit for a regular revision, or contains multiple commits for a merge revision.

Importing does not update any references/branches so the returned hash must be stored as a reference, otherwise the commit will become inaccessible.

Parameters
pDb[in] Database to be imported to the storage.
parents[in] Parent commits of the imported database.
message[in] Commit information.
objectsToSave[in] List of objects to be saved. Optional. Used to perform a partial commit.
Returns
Hash ID of the created commit in the repository.

◆ createObject()

static OdTfRepositoryPtr OdTfRepository::createObject ( OdStreamBufPtr  pStream,
OdDbHostAppServices pHostApp 
)
static

Opens an existing .dsf storage or creates a new .dsf storage.

Parameters
pStream[in] Stream associated with the storage.
pHostApp[in] Platform specific host application services.
Returns
Pointer to the repository object corresponding to the storage.

◆ getCommitInfo()

OdTfCommitInfo OdTfRepository::getCommitInfo ( const OdTfDigest sha) const

Reads from the storage a structure describing relationships of a commit in the revision control database.

Parameters
sha[in] Commit hash.
Returns
Structure describing a commit relationships in the revision control database.

◆ import()

OdTfDigest OdTfRepository::import ( OdDbDatabase pDb,
const OdString localbranch 
)

The initial import to store a .dwg database into the .dsf storage.

Parameters
pDb[in] Database to be stored in the storage.
localbranch[in] Branch to be set as current for commits.
Returns
Hash ID of the created commit in the repository.

◆ init()

void OdTfRepository::init ( const bool  isNewStorage)

Initializes a storage after creation by OdTfRepository::createObject(OdStreamBufPtr, OdDbHostAppServices*).

Parameters
isNewStorage[in] True to create a new storage.

◆ makePatch() [1/2]

OdStreamBufPtr OdTfRepository::makePatch ( const OdTfDigestArray from,
const OdTfDigest to,
const OdTfRevisionControl::ReferenceList refs = OdTfRevisionControl::ReferenceList() 
) const

Intermediate commits along the branch(es) are automatically included.

Collects all the changes since the "from" set of commits to the "to" set of commits. Together with applyPatch() it is designed to transfer changes between repositories.

The "from" set of commits is considered available in the remote repository. The "to" set of commits are the commits that need to be made available on the remote. Also "to" must contain hashes "from". Each names a single commit to be included. So, if all commits of a branch need to be included, then each commit from that branch needs to be included in the "to" set.

Consider the following example scenarios:

Remote: – C7 / C0 – C1 – C2 -----— C5 – C6 \ / ^ – C3 – C4 – master

Local: master v C0 – C1 – C2 \ – C3 ^ branch1

If the local repository has commit 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 commit C3 and commit C6 into the patch {C3, C4, C5, C6}.

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}, {C2, C3, C4, C5, C6, C7})'. This will include all objects from C2, C3, C4, C5, C6 and C7 in the patch not already available in any of the local branches. C2, C3 must be included in the patch. Reason: the local repository stores C2, C3 without compression. But on the remote repository commits, that are not branch head commits, will be compressed {C0, C1, C2, C3, C4, C5}. Patch in the local repository replaces not compressed {C2, C3} to compressed. C7 must be included because it branched from C2.

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, C7})' 'update({}, {master})' which only includes all objects for C6 in the patch.

Parameters
from[in] Set of commit hashes for the starting commits.
to[in] Commit hash of the end commit.
refs[in] Set of references to be included in the patch.
Returns
Pointer to the stream buffer associated with the patch file.

◆ makePatch() [2/2]

OdStreamBufPtr OdTfRepository::makePatch ( const OdTfDigestArray from,
const OdTfDigestArray to,
const OdTfRevisionControl::ReferenceList refs = OdTfRevisionControl::ReferenceList() 
) const

Intermediate commits along the branch(es) are automatically included.

Collects all the changes since the "from" set of commits to the "to" set of commits. Together with applyPatch() it is designed to transfer changes between repositories.

The "from" set of commits is considered available in the remote repository. The "to" set of commits are the commits that need to be made available on the remote. Also "to" must contain hashes "from". Each names a single commit to be included. So, if all commits of a branch need to be included, then each commit from that branch needs to be included in the "to" set.

Consider the following example scenarios:

Remote: – C7 / C0 – C1 – C2 -----— C5 – C6 \ / ^ – C3 – C4 – master

Local: master v C0 – C1 – C2 \ – C3 ^ branch1

If the local repository has commit 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 commit C3 and commit C6 into the patch {C3, C4, C5, C6}.

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}, {C2, C3, C4, C5, C6, C7})'. This will include all objects from C2, C3, C4, C5, C6 and C7 in the patch not already available in any of the local branches. C2, C3 must be included in the patch. Reason: the local repository stores C2, C3 without compression. But on the remote repository commits, that are not branch head commits, will be compressed {C0, C1, C2, C3, C4, C5}. Patch in the local repository replaces not compressed {C2, C3} to compressed. C7 must be included because it branched from C2.

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, C7})' 'update({}, {master})' which only includes all objects for C6 in the patch.

Parameters
from[in] Set of commit hashes for the starting commits.
to[in] Set of commit hashes for the ending commits.
refs[in] Set of references to be included in the patch.
Returns
Pointer to the stream buffer associated with the patch file.

◆ writeCommitInfo()

OdTfDigest OdTfRepository::writeCommitInfo ( OdTfCommitInfo commitInfo)

Writes to the storage a structure describing relationships of a commit in the revision control database.

Parameters
commitInfo[in] Structure describing relationships of a commit in the revision control database.
Returns
Hash of the write commit.
Remarks
Also the hash of the write commit is stored in the current OdTfCommitInfo structure (OdTfCommitInfo::hash field in the commitInfo parameter).

The documentation for this class was generated from the following file: