It's all about the answers!

Ask a question

find when a change(set) was delivered into a component/stream

Bernd van Oostrum (21725371) | asked Feb 25 '20, 4:01 a.m.

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,

Accepted answer

permanent link
Andrew Niefer (7135) | answered Feb 28 '20, 2:59 p.m.
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. 

Unfortunately there is no API to find an appropriate ChangeHistoryHandle that will point to a particular change set in the history of a workspace.

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.

Bernd van Oostrum selected this answer as the correct answer

Bernd van Oostrum commented Mar 02 '20, 4:00 a.m.
Solved by first retrieving a history of the component in a list, then iterating on all changesets in the workspace related to a certain versionable and then matching that changeset with the list...


Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.