CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
OdTfRevisionControl Namespace Reference

Typedefs

typedef std::map< OdString, OdTfDigestReferenceList
 
typedef std::map< OdDbHandle, ChangeTypeChangeList
 

Enumerations

enum  ChangeType { kObjectUnmodified = 0 , kObjectAdded = 1 , kObjectDeleted , kObjectModified }
 
enum  MergeFlags {
  kMergeFlagBase = 0 , kMergeFlagMine = 1 , kMergeFlagTheirs = 2 , kMergeFlagFull = 4 ,
  kMergeMaskMineTheirs = kMergeFlagMine | kMergeFlagTheirs , kMergeMaskResolution = kMergeMaskMineTheirs | kMergeFlagFull
}
 
enum  MergeResolution {
  kMergeRevertFull = kMergeFlagBase | kMergeFlagFull , kMergeMineConflict = kMergeFlagMine , kMergeMineFull = kMergeFlagMine | kMergeFlagFull , kMergeTheirsConflict = kMergeFlagTheirs ,
  kMergeTheirsFull = kMergeFlagTheirs | kMergeFlagFull , kMergePostpone = kMergeMineFull , kMergeNoResolution = 0
}
 

Functions

bool isConflict (ChangeType myChange, ChangeType theirChange)
 
TFDLL_EXPORT OdTfRepositorygetRepository (OdDbDatabase *pDb)
 
TFDLL_EXPORT OdTfRepositoryPtr detachRepository (OdDbDatabase *pDb)
 
TFDLL_EXPORT OdTfDigest commit (OdDbDatabase *pDb, const OdTfCommitAnnotation &message, const OdDbObjectIdArray *objectsToSave=0)
 
TFDLL_EXPORT bool dryMerge (const OdDbDatabase *pDb, const OdTfDigest &sha, OdTfMergeHandler &mergeHandler)
 
TFDLL_EXPORT bool dryMerge (const OdDbDatabase *pDb, const OdString &reference, OdTfMergeHandler &mergeHandler)
 
TFDLL_EXPORT bool merge (OdDbDatabase *pDb, const OdTfDigest &sha, OdTfMergeHandler &mergeHandler, bool noFastForward=false)
 
TFDLL_EXPORT bool merge (OdDbDatabase *pDb, const OdString &reference, OdTfMergeHandler &mergeHandler, bool noFastForward=false)
 
TFDLL_EXPORT OdString getLocalBranch (OdDbDatabase *pDb, OdTfDigest *head=0)
 
TFDLL_EXPORT void switchBranch (OdDbDatabase *pDb, const OdString &branch, bool hard=true)
 
TFDLL_EXPORT OdDbObjectIdArray getLocalChanges (OdDbDatabase *pDb)
 
TFDLL_EXPORT OdStreamBufPtr compressData (OdDbDatabase *pDb)
 
TFDLL_EXPORT void loadObjects (OdDbDatabase *pDb, OdDbObjectIterator *pObjects, OdMTLoadReactor *pReactor=0)
 
TFDLL_EXPORT void beginPartialImport (OdStreamBufPtr pStream, OdDbDatabase *pDb)
 
TFDLL_EXPORT void writeObjectPartial (OdDbObjectId id, bool pageObjectToDisk=true)
 
TFDLL_EXPORT void endPartialImport (OdDbDatabase *pDb)
 
TFDLL_EXPORT void getRevisionDifference (OdDbDatabase *pDb, const OdTfDigest &newRevision, const OdTfDigest &oldRevision, ChangeList &result)
 
TFDLL_EXPORT bool getCommonAncestor (OdDbDatabase *pDb, const OdTfDigest &theirSha, OdTfDigest &ancestor)
 

Detailed Description

This namespace contains revision control specific definitions.

Typedef Documentation

◆ ChangeList

Change list.

Definition at line 161 of file TfRevisionControl.h.

◆ ReferenceList

Reference list.

Definition at line 141 of file TfRevisionControl.h.

Enumeration Type Documentation

◆ ChangeType

Declares change types.

Enumerator
kObjectUnmodified 

Object not modified or not existing

kObjectAdded 

Object added to database

kObjectDeleted 

Object deleted from database

kObjectModified 

Object modified

Definition at line 146 of file TfRevisionControl.h.

◆ MergeFlags

Flags for defining the MergeResolution values.

Enumerator
kMergeFlagBase 
kMergeFlagMine 
kMergeFlagTheirs 
kMergeFlagFull 
kMergeMaskMineTheirs 
kMergeMaskResolution 

Definition at line 166 of file TfRevisionControl.h.

◆ MergeResolution

Declares merge resolutions.

Enumerator
kMergeRevertFull 

Reject changes of both sides and revert to the object revision of the base.

kMergeMineConflict 

Resolve the conflict by preferring my changes over their changes for conflicting properties of the object.

kMergeMineFull 

Resolve the conflict by preserving all my changes and discard all their changes to the object.

kMergeTheirsConflict 

Resolve the conflict by preferring their changes over my changes for conflicting properties of the object.

kMergeTheirsFull 

Resolve the conflict by discarding all my changes and integrate all their changes to the object.

kMergePostpone 

Do not resolve the conflict in any way yet. The conflict should be recorded for later resolving.

kMergeNoResolution 

Passed in autoResolution to OdTfMergeHandler if the conflict can not be resolved automatically and requires an explicit decision. Not to be returned by OdTfMergeHandler!

Definition at line 179 of file TfRevisionControl.h.

Function Documentation

◆ beginPartialImport()

TFDLL_EXPORT void OdTfRevisionControl::beginPartialImport ( OdStreamBufPtr  pStream,
OdDbDatabase pDb 
)

Begins partial import of the database into the revision control storage if the full import cannot be performed or not needed.

Remarks
Branch name and commit information are default.
Parameters
pStream[in] Stream, associated with the storage.
pDb[in] Database to be imported to the storage.

◆ commit()

TFDLL_EXPORT OdTfDigest OdTfRevisionControl::commit ( OdDbDatabase pDb,
const OdTfCommitAnnotation message,
const OdDbObjectIdArray objectsToSave = 0 
)

Saves changes in the database to the repository, creates a commit object and shifts the current branch tip if not checkout as detached. The "objectsToSave" optional parameter is a list of objects to save. It can be used to perform a partial commit.

Includes all tracked merged commits as parents of the commit.

Parameters
pDb[in] The database, which state has to be saved.
message[in] Commit message.
objectsToSave[in] A list of objects to be saved. Optional. Used to perform a partial commit.
Returns
Hash code of the commit.

◆ compressData()

TFDLL_EXPORT OdStreamBufPtr OdTfRevisionControl::compressData ( OdDbDatabase pDb)

Creates a new OdStreamBufPtr with compressed data from the OdTfStorage linked to the OdDbDatabase.

Parameters
pDb[in] Database linked to the OdTfStorage.
Returns
New storage stream buffer.

◆ detachRepository()

TFDLL_EXPORT OdTfRepositoryPtr OdTfRevisionControl::detachRepository ( OdDbDatabase pDb)

Removes the link between the OdDbDatabase and the OdTfStorage.

Parameters
pDb[in] Database linked to the OdTfStorage.
Returns
Pointer to the OdTfRepository object. Returns a NULL pointer if the database is not linked to the OdTfStorage.

◆ dryMerge() [1/2]

TFDLL_EXPORT bool OdTfRevisionControl::dryMerge ( const OdDbDatabase pDb,
const OdString reference,
OdTfMergeHandler mergeHandler 
)

◆ dryMerge() [2/2]

TFDLL_EXPORT bool OdTfRevisionControl::dryMerge ( const OdDbDatabase pDb,
const OdTfDigest sha,
OdTfMergeHandler mergeHandler 
)

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.

Parameters
pDb[in] The database to be used as my side for the merge.
sha[in] Commit to use as their side for merge.
reference[in] Branch to use as their side for merge.
mergeHandler[in] Callback for recording/inspecting all changes.
Returns
False if merge would be a fast forward; true otherwise.

◆ endPartialImport()

TFDLL_EXPORT void OdTfRevisionControl::endPartialImport ( OdDbDatabase pDb)

Ends the partial import to the revision control storage creating a first revision.

Parameters
pDb[in] Database to end the partial import.

◆ getCommonAncestor()

TFDLL_EXPORT bool OdTfRevisionControl::getCommonAncestor ( OdDbDatabase pDb,
const OdTfDigest theirSha,
OdTfDigest ancestor 
)

Find common parent of two commits.

Parameters
pDb[in] Database linked to the OdTfStorage.
theirSha[in] Hash code of other(their) commit.
ancestor[out] Hash code of common parent for theirSha and current branch.

Note: local(mine) hash code of commit is taken from the local branch it is currently in the OdTfStorage.

◆ getLocalBranch()

TFDLL_EXPORT OdString OdTfRevisionControl::getLocalBranch ( OdDbDatabase pDb,
OdTfDigest head = 0 
)

Returns the name of the current working branch.

Parameters
pDb[in] Database to get the working branch from.
head[out] Hash code of the branch head commit.
Remarks
If no revision control storage is associated with the database, returns OdString::kEmpty.
Returns
Current working branch name.

◆ getLocalChanges()

TFDLL_EXPORT OdDbObjectIdArray OdTfRevisionControl::getLocalChanges ( OdDbDatabase pDb)

Gets a list of objects that were changed since the last commit.

Parameters
pDb[in] Database to get the list of changes.
Returns
An array of object IDs.

◆ getRepository()

TFDLL_EXPORT OdTfRepository * OdTfRevisionControl::getRepository ( OdDbDatabase pDb)

Gets an existing .dsf storage.

Parameters
pDb[in] Database linked to the OdTfStorage.
Returns
Pointer to the OdTfRepository object. Returns a NULL pointer if the database is not linked to the OdTfStorage.

◆ getRevisionDifference()

TFDLL_EXPORT void OdTfRevisionControl::getRevisionDifference ( OdDbDatabase pDb,
const OdTfDigest newRevision,
const OdTfDigest oldRevision,
ChangeList result 
)

Gets a list of handles of the objects that differ between revisions. Revisions may actually be unrelated.

Parameters
pDb[in] Database which storage to get the list of differences from.
newRevision[in] Hash code of the first revision.
oldRevision[in] Hash code of the second revision.
result[out] List of changes, containing IDs of objects that differ between revisions.

◆ isConflict()

bool OdTfRevisionControl::isConflict ( ChangeType  myChange,
ChangeType  theirChange 
)
inline

Check if my and their changes of the object conflict and requires an explicit resolution.

Changes conflict when both sides are modified or when one side is modified and the other side has been deleted.

Parameters
myChangeChangeType of the object of my side.
theirChangeChangeType of the object of their side.
Returns
true if ChangeType of my and their side poses a true conflict that requires explicit resolving.

Definition at line 218 of file TfRevisionControl.h.

◆ loadObjects()

TFDLL_EXPORT void OdTfRevisionControl::loadObjects ( OdDbDatabase pDb,
OdDbObjectIterator pObjects,
OdMTLoadReactor pReactor = 0 
)

Loads objects from the storage if earlier a partial checkout was performed.

Remarks
This function is designed to run in a separate thread.
Parameters
pDb[in] Database to load objects to.
pObjects[in] Iterator that contains a list of objects to be loaded.
pReactor[in] Reactor for multi-threaded loading. Optional.

◆ merge() [1/2]

TFDLL_EXPORT bool OdTfRevisionControl::merge ( OdDbDatabase pDb,
const OdString reference,
OdTfMergeHandler mergeHandler,
bool  noFastForward = false 
)

◆ merge() [2/2]

TFDLL_EXPORT bool OdTfRevisionControl::merge ( OdDbDatabase pDb,
const OdTfDigest sha,
OdTfMergeHandler mergeHandler,
bool  noFastForward = false 
)

Merges changes from the repository to the database. Merge operation does not automatically commit changes, only runtime database is changed.

Adds the source commit as a tracked merge parent for this drawing. This makes the source commit as a parent when committing the changes to the repository.

Remarks
If merge was fast forward, no merge commit is necessary. If "noFastForward" flag is true, and the remote branch is directly above or below this one in the commit graph, the function does nothing.
Parameters
pDb[in] A database to merge into.
sha[in] Commit to use as their side for merge.
reference[in] Branch to use as their side for merge.
conflictHandler[in/out] Callback for handling merge conflicts.
noFastForward[in] Flag that prohibits fast forward merging (when true).
Returns
False if merge was fast forward; true otherwise.

◆ switchBranch()

TFDLL_EXPORT void OdTfRevisionControl::switchBranch ( OdDbDatabase pDb,
const OdString branch,
bool  hard = true 
)

Updates the database to the revision on the tip of the specified branch and makes this branch default for commits. All uncommitted changes in the runtime database will be lost. This behavior can be modified by setting the "hard" flag. If "hard" is set to false and there are non-committed changes in the database, operation will fail. If "hard" is true (default), all non-committed changes will be lost.

Parameters
pDb[in] Database which storage to switch the branch in.
branchName[in] Name of the branch to switch to.
hard[in] Flag that defines the behavior of the function if there are non-committed changes in the database.

◆ writeObjectPartial()

TFDLL_EXPORT void OdTfRevisionControl::writeObjectPartial ( OdDbObjectId  id,
bool  pageObjectToDisk = true 
)

Imports an object to the storage.

Remarks
Used only with beginPartialImport() and endPartialImport().
Parameters
id[in] ID of the object to be imported to the storage.
pageObjectToDisk[in] If true (default) flushes the stream buffer to the file after importing the object.