find when a change(set) was delivered into a component/stream
I need to be able to retrieve the moment a changesset was delivered into a stream using the client sdk,
I'm looking to get that info directly from a changeset, change or fileitem.
So far I used:
- ParmsGetComponentHistory to retrieve the ScmComponentHistory
This works, but returns all changesets for the component which then need to be iterated through to find the changeset I'm looking for.
- IChangeHistory to retrieve the ClientChangeSetEntry
This works too, but in some cases (don't know exactly when) the entry.creationDate() is empty
Best regards,
Bernd.
Accepted answer
I think you'll have to end up iterating through history to find your change set.
There are a few different APIs to get the delivery information, ultimately all of them are getting history starting at some point and going back in the history tree. That starting point is generally either the current state for the Workspace/Component or a older spot in history designated by a ChangeHistoryHandle.
This leaves you will little choice but to iterate to find it.
If you are using IChangeHistory, make sure you get it from a WorkspaceConnection and not a BaselineConnection. That could be one explanation for when the entry.creationDate is empty.
IScmService.getChangeHistoryDescriptors is another entry point (also getChangeHistoryDescriptor, and recentEntries). If you use IScmService directly, the calls need a ServiceHistoryProvider, you need to use one of the ServiceHistoryProvider.FACTORY methods that takes a IWorkspaceHandle to get the deliver information.