It's all about the answers!

Ask a question

Comparing baselines for a component

Vikas Kokare (1644) | asked Aug 23 '12, 4:34 a.m.
edited Aug 23 '12, 5:38 a.m.
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();
        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?

Ralph Schoon commented Aug 23 '12, 5:26 a.m.

Nice finding. However, you should try to ask questons in this forum.

Vikas Kokare commented Aug 23 '12, 5:36 a.m. | edited Aug 23 '12, 5:39 a.m.

I have a question now updated regarding baselines sharing the same name.

One answer

permanent link
Vikas Kokare (1644) | answered Aug 23 '12, 8:59 a.m.
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

Register or to post your answer.