Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Using API, how to compare two baselines to get changesets

I need to get a list of changesets which are the changes between two baselines of a component. I see there is a BaselineComparison class, but have not found a way to use it. Some example code would be greatly appreciated. Thx!

0 votes



3 answers

Permanent link
Thanks for the help John. I was able to get both ways to work with your help. Here is some example code for reference.

Assuming baseline1 and baseline2 are provided IBaseline instances

Using IBaselineConnection (simpler):

IBaselineConnection baselineConn = SCMPlatform.getWorkspaceManager(repo).getBaselineConnection(baseline1, monitor);
IChangeHistorySyncReport syncReport = baselineConn.compareTo(baseline2, monitor);
List<IChangeSetHandle> changeSets = syncReport.incomingChangeSets(); // or outgoing depending on order of baselines


Using IScmService.compareBaselines:

IScmService scmService = (IScmService) ((IClientLibraryContext)repo).getServiceInterface(IScmService.class);
IReference baseline1Ref = referenceFactory.createReferenceToItem(baseline1);
IReference baseline2Ref = referenceFactory.createReferenceToItem(baseline2);

IBaselineHandle baseline1Handle = (IBaselineHandle) baseline1Ref.resolve();
IBaselineHandle baseline2Handle = (IBaselineHandle) baseline2Ref.resolve();

IChangeHistorySyncReport syncReport = scmService.compareBaselines(baseline1Handle, baseline2Handle, null, null);
List<IChangeSetHandle> changeSets = syncReport.incomingChangeSets(); // or outgoing depending on order of baselines

1 vote


Permanent link
I would also like to be to start with a build as an input to the baseline comparison. I found the example of how to query for a build and get a IBuildResult object. Can I use this to get at the baseline that the build created?

I need to get a list of changesets which are the changes between two baselines of a component. I see there is a BaselineComparison class, but have not found a way to use it. Some example code would be greatly appreciated. Thx!

0 votes


Permanent link
I would also like to be to start with a build as an input to the baseline comparison. I found the example of how to query for a build and get a IBuildResult object. Can I use this to get at the baseline that the build created?

I need to get a list of changesets which are the changes between two baselines of a component. I see there is a BaselineComparison class, but have not found a way to use it. Some example code would be greatly appreciated. Thx!


BaselineComparison is in the repository model and despite its name, it does not have anything to do with Jazz Source Control baselines.

On the client-side, you can use IBaselineConnection#compareTo() to compare 2 baselines. On the server, you can use IScmService#compareBaselines(). Both return a sync-report which describes which change sets are unique to a particular baseline.

Builds are associated w/snapshots and snapshots contain multiple baselines ... so you would need to iterate throughout all common components and compare each component one at a time.

Hope this helps,
JohnC
SCM Server

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 04 '09, 9:46 a.m.

Question was seen: 5,670 times

Last updated: Dec 21 '12, 8:59 a.m.

Confirmation Cancel Confirm