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

compare component with baseline across stream for shared component.

 I have below scenario of stream in my project area

Demo Stream 6
Shared_Comp_1(5: Snap_1)

Demo Stream 7
Shared_Comp_1(4: Snap_3)

"Shared_Comp_1"  is shared in Demo Stream 6 and Demo Stream 7

There are no change sets in comparison when "Shared_Comp_1"  is compared with Snap_1 for Demo Stream 6.
However when I compare "Shared_Comp_1"  from Demo Stream 6 with Snap_3 baseline of "Shared_Comp_1"  from Demo Stream 7, there are change sets.
I am doing above comparison in eclipse client(client version is 5.0.2)

I want to compare "Shared_Comp_1" component from Demo Stream 6 with latest baseline Snap_3 of "Shared_Comp_1" from Demo Stream 7.

When I do it using java api it shows me no change sets, because instead of fetching Snap_3 as latest baseline from "Shared_Comp_1" of Demo Stream 7, it fetches Snap_1 as latest baseline form "Shared_Comp_1".

How can I fetch Snap_3 as latest baseline from "Shared_Comp_1" of Demo Stream 7 and compare it with "Shared_Comp_1" component of Demo Stream 6 using java client API



0 votes



One answer

Permanent link
Here is how you get the last baseline (known as the 'basis') of a component in a workspace or stream.

// Fetch a handle to the last baseline (basis)

ITeamRepository repo = <repo_of_the_stream>;

IWorkspaceManager manager = SCMPlatform.getWorkspaceManager(repo);

IWorkspaceHandle workspaceHandle = <this_is_the_handle_for_the_stream> ;

IWorkspaceConnection wc = manager.getWorkspaceConnection(workspaceHandle , monitor);

IComponentHandle component = <this_is_the_component_you_care_about> ;

IBaselineHandle basisHandle = wc.getComponentInfo(component).basis();

// Repeat the above for the other stream.
// Compare the two baselines (it sounds like you know how to do that already though)



//Fetch the full baseline (if you want the name of the baseline etc, etc.)

IFetchResult fetchResult =  repo.itemManager().fetchCompleteItemsPermissionAware(Collections.singletonList(basisHandle), ItemManager.DEFAULT, monitor);

IBaseline fetchedBaseline;

if (fetchResult.getRetrievedItems().size() == 1) {

   fetchedBaseline = fetchResult.getRetrievedItems().get(0);

}


0 votes

Comments

 Hi David,

Above solution worked to fetch latest baseline,
However I have a bit complex scenario for comparison of baseline, where I cannot get correct change sets.
I am comparing component of Demo Stream 6 i.e. Shared_Comp_1 with with latest baseline of Shared_Comp_1 of Demo Stream 7. 
I can not get correct results.
I can explain scenario in details if needed, please let me know.

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
× 10,938
× 411

Question asked: Apr 25 '16, 9:26 a.m.

Question was seen: 3,305 times

Last updated: May 25 '16, 12:59 a.m.

Confirmation Cancel Confirm