It's all about the answers!

Ask a question

How ILocateChangeset works internally?

Andrew Ciaz (59147) | asked Jun 18 '19, 5:30 a.m.

 Hi guys,

I need to find out change set belongs to which baseline, but suppose my component "ABC" has two changesets which are "Base1" and "Base2" and my my changeset is present "Base1" the my following code returns all the two baseline while I execute ILocateChangeSet api, following is my code snippet:

ILocateChangeSetsSearchCriteria scope = ILocateChangeSetsSearchCriteria.FACTORY.create(changeSetHandleList , workspaceHandlesList, Collections.EMPTY_LIST, baselineHandleList);
List<ILocateChangeSetsSearchResult> locateChangeSetResults = manager.locateChangeSets(scope, monitor);
for(ILocateChangeSetsSearchResult result : locateChangeSetResults)

List<IBaselineHandle> baselineHandles = result.getBaselines();
for(IBaselineHandle handle : baselineHandles)

IBaseline base1 = (IBaseline) flowWorkspaceConnection.teamRepository().itemManager()
.fetchCompleteItem(handle,IItemManager.DEFAULT, null);

Andrew Ciaz commented Jun 18 '19, 6:45 a.m.

I think the code should return only "Base1"  baseline which contain changeset but code returns all the baselines

Accepted answer

permanent link
David Lafreniere (4.8k7) | answered Jun 19 '19, 11:40 a.m.
The Locate Change Sets API checks if the change set exists in the [component] history of the context (where context is a stream/workspace/baseline/snapshot).

For example, in the RTC Eclipse client, if you were to right-click on a component in either a workspace or stream and select "Show" --> "History", it will open up the History view showing all the change sets in that workspace/stream (in that component). When talking about streams, change sets usually get there via a 'deliver' action, but someone could have performed a 'replace' operation on the stream. For workspace, change sets can get there by the 'change set creation' operation', or by an 'accept' or even a 'resume' operation.

Similarly, for baselines, if you were to right-click on a baseline and select "Show" --> "History", it will do pretty much the same thing as when you performed that action on a stream or workspace. It will open up the History view and show all change sets in that baseline.

So if you were to find the change set in that History view, then it is considered 'in' that context, and if you don't find the change set then it's considered to be 'not' in that context (this is how the LCS API works).
Andrew Ciaz selected this answer as the correct answer

Andrew Ciaz commented Jun 20 '19, 9:40 a.m.

Thanks  @David Lafreniere 

Your answer

Register or to post your answer.