It's all about the answers!

Ask a question

Eclipse client API : find completed change sets

Gidi Gal (962054) | asked Apr 22 '20, 1:04 p.m.


I am looking for an API that finds completed change-sets.
If I understand correctly, the API IChangeSet.isActive indicates whether change-set is completed (not active) or not.
I know the API IWorkspaceConnection.activeChangeSets() returns list of active change sets. Is there an API for non-active change-sets ?


One answer

permanent link
David Lafreniere (4.8k7) | answered Apr 24 '20, 9:01 p.m.
We don't have API for finding all closed change sets. I guess statistically speaking, most change sets in the database would be closed (i.e. anytime you deliver or discard a change set, or create a baseline, any open change sets get automatically closed).
Feel free to open an enhancement request.

(As a FYI even though it doesn't answer your question, in addition to IWorkspaceConnection.activeChangeSets(), this class is also relevant for querying for change sets: IChangeSetSearchCriteria, which is used in IWorkspaceManager.findChangeSets(...))

Gidi Gal commented Apr 25 '20, 8:30 a.m. | edited Apr 25 '20, 8:35 a.m.

 Hi David,

Thanks for your reply. Below is the manual scenario I am trying to solve with API:
1) User modifies file a.txt and performs check-in to new change-set cs1.
2) User completes cs1.
3) User modifies file a.txt again and performs check-in to new change-set cs2.
4) User tries to deliver cs2. An error is reported: Delivering these changes would introduce gaps in the stream.
5) User selects both cs1 and cs2 and delivers them successfully.

Is there an API (or a set of APIs) to find the completed cs1 ? I find cs2 by IWorkspaceConnection.activeChangeSets(), how do I find whether there are change-sets that introduce gaps ? If there is no such API, I'll open enhancement request.

David Lafreniere commented Apr 26 '20, 11:11 a.m. | edited May 25 '20, 9:51 a.m.
You can get the IWorkspaceConnection for the stream that you are trying to deliver to, and call findChangeSetsToAcceptToFillGap(...) and see what that returns (Note: The API was designed for the accept use case, but it may returned desired results if used with the stream, I just have not tried it, if you do, post back the results to this forum)

Gidi Gal commented May 17 '20, 1:59 p.m.

Thanks for your reply, David. I have another use case I need to solve:

1) User performs several changes in file a.txt. Each change is checked-in to a change-set and the change-set is marked by the user as completed.
2) User wishes to deliver all his completed change-sets related to file a.txt.

I can use IFlowNodeConnection.changeHistory and IChangeHistory.getHistoryFor for both workspace connection and its target workspace connection for deliveries and then compare the two. Is this approach correct ? I stop at the first change-set which is part of the target workspace connection. In case the first change-set is active - I stop and return null, since the API you mentioned should solve this scenario.
Regarding finding the target workspace connection, I use IComponentSyncModel, which is internal API. Is there public API for this task ? Thanks.

Gidi Gal commented May 18 '20, 7:50 a.m.

Regarding the API findChangeSetsToAcceptToFillGap - seems that it is not working for deliver scenario.

I used it for accept scenario and it works well.

Should I report it as a defect ?

Gidi Gal commented May 18 '20, 12:50 p.m.

I found that the public API to find the target workspace connection is IWorkspaceConnection.getCurrentDeliverFlow().getFlowNode() and the transform the IFlowNodeHandle to IWorkspace using ITeamRepository.itemManager().fetchCompleteItem().

I am still unable to use the API findChangeSetsToAcceptToFillGap to calculate the gap. Should I use a different workspace connection ?

David Lafreniere commented May 19 '20, 12:37 p.m.
Yes that is the correct API to find the flow target.

IWC.findChangeSetsToAcceptToFillGap() was written to help with use cases of trying to accept changes into a workspace, and not really what to identify what can be delivered. I would have thought if you used that method on the flow target (stream) it might result in similar information. So if you call that API on the stream that you want to deliver to, what doesn't work for you? (what are the results when you try?)
showing 5 of 6 show 1 more comments

Your answer

Register or to post your answer.