How to List all outgoing ChangeSets using plain Java API
![]()
Liora Milbaum (513●2●82●116)
| asked Oct 15 '12, 5:05 p.m.
edited Sep 07 '16, 7:18 p.m. by David Lafreniere (4.8k●7)
Hi,
How do I list all change sets in a given workspace which are waiting to be delivered (in the outgoing folder) using plain Java API?
This is the snippet of the code. The only issue here is the criteria. How to set it correctly?
IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setOldestFirst(true);
IProgressMonitor monitor;
List<IChangeSetHandle> changeSets =
SCMPlatform.getWorkspaceManager(teamRepository).findChangeSets(criteria, Integer.MAX_VALUE, monitor);
Your assistance will be greatly appreciated.
Thanks,
Liora
|
Accepted answer
5 other answers
![]()
I am on the last mile of the marathon:-)
My target is to deliver the change Sets one by one. The deliver method is not working.
IWorkspaceManager wm = (IWorkspaceManager)teamRepository.getClientLibrary(IWorkspaceManager.class);
IWorkspaceSearchCriteria criteria1 = IWorkspaceSearchCriteria.FACTORY.newInstance();
criteria1.setKind( IWorkspaceSearchCriteria.WORKSPACES );
criteria1.setExactName( INTEGRATION_WORKSPACE );
criteria1.setExactOwnerName(INTEGRATION_WORKSPACE_OWNER);
List<IWorkspaceHandle> workspaceHandles = wm.findWorkspaces(criteria1, Integer.MAX_VALUE, monitor);
IWorkspaceHandle wh = workspaceHandles.get( 0 );
IWorkspaceConnection workspaceConnection = wm.getWorkspaceConnection(wh, monitor);
IFlowTable flowTable = workspaceConnection.getFlowTable();
IFlowEntry flowEntry = flowTable.getCurrentDeliverFlow();
IFlowNodeHandle streamHandle = flowEntry.getFlowNode();
IWorkspaceConnection workspaceConnection1 = wm.getWorkspaceConnection((IWorkspaceHandle) streamHandle, monitor);
IChangeHistorySyncReport changeHistorySyncReport = workspaceConnection.compareTo(workspaceConnection1,
WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY,
Collections.EMPTY_LIST, monitor);
List<IChangeSetHandle> outgoingChangeSets = changeHistorySyncReport.outgoingChangeSets();
for (IChangeSetHandle changeSet : outgoingChangeSets) {
workspaceConnection.deliver(workspaceConnection1,changeHistorySyncReport ,Collections.EMPTY_LIST,Collections.singletonList(changeSet), monitor);
}
Comments Hello
Follow the instructions in How to access change set file information.
Hello ,
|
![]()
The deliver method is working. There was an issue with the preconditions.
Tim, thanks for the personal attention.
Liora
|