How ILocateChangeset works internally?
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);
}
}
Accepted answer
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).
Comments
Andrew Ciaz
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