Comparing baselines for a component
![]()
I am employing the following code to compare 2 baselines for release stream component to know to list of changesets committed.
IComponentHandle componentHandle = getComponentHandle(componentName); IBaseline fromBaseline = getBaseline(componentHandle, fromSnapshot); IBaseline toBaseline = getBaseline(componentHandle, toSnapshot); IBaselineConnection fromConn = getWsManager().getBaselineConnection(fromBaseline, null); // Calculate the difference IChangeHistorySyncReport syncReport = fromConn.compareTo(toBaseline, null); List<IChangeSetHandle> baselineChanges = syncReport.incomingChangeSets(); I see inconsistent behavior in terms of number of changesets returned. For a certain pair of baselines, the above code returns a bigger number of changes, than seen in the RTC Eclipse based Client. The way for comparison the Eclipse client is to first list the baselines for the Component, and select one to do "Compare with Previous". The implementation of the getBaseline(IComponentHandle, String) is : IBaselineSearchCriteria baselineSearchCriteria = IBaselineSearchCriteria.FACTORY.newInstance(); baselineSearchCriteria.setComponentRequired(componentHandle); baselineSearchCriteria.setExactName(baselineName); baselineSearchCriteria.setOldestFirst(false); List<ibaselinehandle> baselineHandles = getWsManager().findBaselines(baselineSearchCriteria, IWorkspaceManager.MAX_QUERY_SIZE, null); List<ibaseline> baselines = repo.itemManager().fetchCompleteItems(baselineHandles, IItemManager.REFRESH, null); if (baselines.size() > 1) { throw new TeamRepositoryException("More than one matches for baseline " + baselineName); } return baselines.get(0); This code returns more than one baseline (baselines > 1) resulting in a failure even though, the criteria searches for the baseline using exact name for a specific component Are there are more than one baseline(s) sharing the same name, or is it possible that these baselines are being searched across release streams/workspaces? |
One answer
![]()
This is no more a problem, as i figured out the same baseline name was shared across release streams which apparently also share the same component names. As a result, the uniqueness of the baseline was guaranteed. To overcome this, we decided to qualify the baseline name with the Id ie Id:baselineName. When the baseline search returns multiple baselines, we now use the baseline Id for matching the expected baseline.
|
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.
Comments
Nice finding. However, you should try to ask questons in this forum.
I have a question now updated regarding baselines sharing the same name.