It's all about the answers!

Ask a question

How to fetch the baseline to which changeset belongs using rtc plain java api's?


Akshay Daga (134) | asked Apr 26 '19, 3:25 p.m.

I am fetching changesets associated to the workitem. I want  to know to which baseline the changeset is associated to.

2 answers



permanent link
Luca Martinucci (1.0k294112) | answered May 03 '19, 5:29 a.m.

Maybe this code snippet can help you.

I wrote it with server-side java API (it is in a participant), but you can try to adapt it to plain java API.
Once you have a change set, you can check whether it is part of a given baseline using the changeSetsInBaseline method of the IScmService package.

IChangeSetHandle[] csHandleInBaseline = scmService.changeSetsInBaseline(baselineHandle, csHandle, repositoryProgressMonitorHandle);

The method returns an array of change sets that has either 0 (if the change set is not part of the baseline) ot 1 (if the change set is part of the baseline) length.
Check that this way:

int matchLength = csHandleInBaseline.length;

I have not found, so far, a method that returns the baselines of which a change set is part, so I had to retrieve a list of baselines (e.g. on a stream) and iterate over it.


permanent link
Ulf Arne Bister (1.3k413) | answered May 03 '19, 4:32 a.m.
Hi,

please consider the RTC SCM Model as described in https://jazz.net/library/article/126
A changeset belongs to a component, but it can be part of several baselines (i.e. on different streams containing that component). You can verify by using the RTC Eclipse client and looking at context menu of a changeset - what you get offered is the Locate Change Set wizard that will you allow to see of which snapshots, baselines, work item queries etc. the change set is a part.

So you can fetch the component of a changeset. From the component you can determine the baseline list. You can query for "interesting" baselines and determine whether the change set is a part of them.

It might be easier if you could describe the underlying use case: what do you want to achieve with the information work item --> change set --> baseline?

gg,
Arne

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.