It's all about the answers!

Ask a question

updating component hierary via API is not working


Aley Zaidi (43111) | asked Apr 07 '16, 7:45 a.m.
edited Apr 07 '16, 7:51 a.m.
I have following scenario:
component c1 has 3 subcomponents (c2, c3 and c4)

My Use Case:
I want to replace c2 and c3 components with c5 and c6 components

Current Structure:
Parent component : c1
Child components : c2,c3,c4

Target Structure:
Parent component : c1
Child components : c4,c5,c6

I created a workspace and add c1, c2, c3, c4, c5 components in to workspace. Then I used following method to update the hierarchy inside component c1.

// update component hierarchy
IWorkspaceConnection.updateSubcomponentData(c1Handle, addCompHandleList, removeCompHandleList, null, null);
// create outgoing change set.
IChangeHistorySyncReport changeSetSync = wsWorkspaceConn.compareTo(
                          wsStreamConn, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY, Collections.EMPTY_LIST, null);
// delivering change set.
wsWorkspaceConn.deliver(wsStreamConn, changeSetSync, Collections.EMPTY_LIST, changeSetSync.outgoingChangeSets(), null);                        
                        
On delivering change set it threw following exception.
com.ibm.team.scm.common.DeliveryIntroducesConflictsException: CRRTC5042E: Cannot deliver changes since they would create conflicts for item '/.subcomponent_info' in component 'Component 'c1''. Try accepting all incoming changes, resolve the conflicts, then deliver again.at com.ibm.team.scm.service.internal.ScmServiceInternal$2.createException(ScmServiceInternal.java:2834)
at com.ibm.team.scm.service.internal.utils.IExceptionFactory$AbstractExceptionFactory.createException(IExceptionFactory.java:35) at com.ibm.team.scm.service.internal.ScmServiceInternal.deliverCombined(ScmServiceInternal.java:2945)



for you feedback i would be thankful



 

Comments
Aley Zaidi commented Apr 07 '16, 7:57 a.m. | edited Apr 09 '16, 12:39 p.m.

From the exception it looks like that I have an older version (with sub set of change sets) of the component in my repository workspace. But I am using the following way to add component in to workspace.

List<IComponentHandle> streamCompHandles = wsStreamConn.getComponents();
for (IComponentHandle streamCompHandle : streamCompHandles ) {
    // add the component to the newly created workspace
    IComponentOp addOperatrion = wsWorkspaceConn.componentOpFactory().addComponent(streamCompHandle, false);
    List operationList = new ArrayList();
operationList.add(addOperatrion);     wsWorkspaceConn.applyComponentOperations(operationList, null); } // for loop
It looks like that

wsStreamConn.getComponents()

is giving an old baseline of the component which is then added to the workspace.

Accepted answer


permanent link
Christoph Schwegele (26) | answered Apr 14 '16, 7:32 a.m.
Hi Aley,

It looks like that the component have different baselines in the stream and in the workspace repository. While adding components (let say with “baseline 4”) from stream  to the workspace repository make sure that the same “baseline 4” is added to your repository.  Only after that change set commit should not throw “DeliveryIntroducesConflictsException”. 

Aley Zaidi selected this answer as the correct answer

Your answer


Register or to post 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.