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?
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.
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Aug 23 '12, 5:26 a.m.Nice finding. However, you should try to ask questons in this forum.
Vikas Kokare
Aug 23 '12, 5:39 a.m.I have a question now updated regarding baselines sharing the same name.