It's all about the answers!

Ask a question

How do you obtain list of change sets being delivered in a Baseline in a Deliver Operation Advisor

Jamie Berry (14013693) | asked Oct 22 '14, 4:51 p.m.
I am working on a Deliver operation advisor to verify change set / work item linkages.  When change sets are delivered by themselves, the DeliverOperationData for the deliver operation provides the list of change sets.  When a baseline is delivered along with some new change sets (as part of the baseline) the DeliverOperationData does not provide the new change sets that are being delivered.  I can get the handle(s) to the baseline(s) being delivered, but I am not seeing a straightforward way to obtain the change sets.  Do I have to compare the baseline against the destination workspace/stream or is there a more direct way of identifying the new change sets?  Does anyone have any example code of how to go from deliverOperationData.getBaselines() to a list of IChangeSetHandles (like is returned from deliverOperationData.getChangeSetHandles()?

Thank you,

Jamie Berry.

One answer

permanent link
Tim Mok (6.6k38) | answered Oct 23 '14, 9:03 a.m.
You can use the source and destination workspaces and compare them with each other.

IWorkspaceConnection connection = SCMPlatform.getWorkspaceManager(ITeamRepository).getWorkspaceConnection(DeliverOperationData.getSourceWorkspace(), monitor);

connection.compareTo(destinationWorkspaceConnection, ..);

You can follow that snippet to get your comparison report. That will return the baselines including change sets that differ from the two workspaces.

Jamie Berry commented Oct 23 '14, 10:42 a.m.

Thanks for your reply.  I am doing this as part of a Deliver operation advisor, so I can't compare the two workspaces as not everything may be delivered.  I have been looking at comparing the baseline that is being delivered to the destination workspace, I just have to figure out how to get the WorkspaceManager from the advisor as I don't have all the same objects as when just writing a stand-alone plain java api based client.  Thanks again.

Tim Mok commented Oct 23 '14, 10:56 a.m.

Oh right, the advisor is being run on the server. You should obtain IScmService to compare your baseline and workspace.

Ralph Schoon commented Oct 23 '14, 11:14 a.m.

Jamie Berry commented Oct 23 '14, 12:59 p.m.

Thanks everyone.  I have my advisor working as desired (for the most part) now.  I wound up using:

IChangeHistorySyncReport syncRpt = scmService.compareWorkspaceToBaseline((IWorkspaceHandle)destWS.getItemHandle(), iBaselineHandle, null, null);

to compare the Baseline to the Destination workspace.  The IncomingChangeSets then had the chagne sets in the Baseline that were being delivered.  The only concern I have with this call is that scmService.compareWorkspaceToBaseline doesn't accept IProgressMonitor but uses IRepositoryProgressMonitorHandle .  I didn't see a way to convert the monitor I have to the monitor handle, so I just used null.  It works, but I don't know if there will be any issues with the progress not being reported for the baseline/workspace comparison...  If anyone has hints on how to get the IRepositoryProgressMonitorHandle object from a server side delivery advisor, I would appreciate it.

Thanks again.

Tim Mok commented Oct 23 '14, 1:05 p.m.

You can do something like this to get a repository monitor:

IRepositoryProgressMonitor repositoryMonitor = IRepositoryProgressMonitor.ITEM_FACTORY

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.