IRepositoryObjectVersion::MergeVersion
This method changes the current object version by combining its property values and origin collections with the property values and origin collections of another version of the same object.
HRESULT MergeVersion(
IRepositoryObjectVersion *pOtherVersion
long fFlags
);
Parameters
*pOtherVersion
[in]
The IRepositoryObjectVersion interface pointer for the predecessor of the merge. That is, the object version whose property values and collections should be merged into the current version.
fFlags
[in]
Long integer specifying which object version is the primary and which is secondary in the merge.
Constant | Value | Description |
---|---|---|
PRIMARY | 1 | The predecessor object is primary and the current object is secondary. |
SECONDARY | 2 | The predecessor object is secondary and the current object is primary. |
Return Value
S_OK
The method completed successfully.
This method failed to complete successfully.
Remarks
Relationships are inserted at the end of the sequenced collection.
The two object versions must be versions of the same object.
The current object version must be unfrozen. The other object version must be frozen.
MergeVersion compares the property values and collections of each object version to a third version, called the Basis Version.
The repository engine considers one of the two to-be-merged object versions as the primary version, and the other to be the secondary version, according to the value of fFlags you supply. During the merge, the repository engine considers each property and origin collection type in turn. For each property, MergeVersion uses this rule:
- If the primary version differs from the Basis Version, the repository engine uses the property value from the primary version. If only the secondary version differs from the Basis Version, the repository engine uses the property value from the secondary version. If neither version differs from the Basis Version, the repository engine leaves the property value in the current version unchanged.
For each origin collection type whose COLLECTION_MERGEWHOLE flag is set, MergeVersion uses this rule:
- If the primary version's collection differs from the Basis Version's collection, the repository engine uses the collection from the primary version. If only the secondary version's collection differs from the Basis Version's, the repository engine uses the collection from the secondary version. If neither version differs from the Basis Version, the repository engine leaves the property value in the current version unchanged.
For each origin collection type whose COLLECTION_MERGEWHOLE flag is not set, MergeVersion combines the items in the two collections as follows:
- MergeVersion includes in the resulting collection each item in the Basis Version not changed in or deleted from either the primary version or secondary version.
- MergeVersion includes in the resulting collection each item in the primary version's collection that differs from the Basis Version.
- MergeVersion includes in the resulting collection each item in the secondary version's collection that differs from the Basis Version, provided the corresponding items in the primary version and the Basis Version do not differ from each other.
The resulting collection can exclude some items found in the basis object version's collection. For example, if the primary version's collection excludes the item, the resulting collection excludes the item. Similarly, if the primary version's collection includes an item that is identical to an item in the Basis Version's collection, but the secondary object version excludes the item, the resulting collection excludes the item.