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

API - Get change set list of a Stream ?

Use case:
To make report on change set delivery over a time on Stream. Need to get list of all change sets delivered for a Stream.

User knows Stream Name and provides this as an input, to get all changesets delivered for this stream.

Is there an API or change set exporter for a stream.?

0 votes


Accepted answer

Permanent link
You can get the history of the component in your stream by using the following api:
ChangeHistoryWithBaselinesResult IWorkspaceConnection#ChangeHistoryWithBaselinesResult fetchChangeHistoryWithBaselines(IComponentHandle component, ChangeHistoryHandle nextPageToken, int pageSizeHint, IProgressMonitor monitor)

List<ChangeHistoryEntry> ChangeHistoryWithBaselinesResult#getChangeHistoryEntries()

Ralph Schoon selected this answer as the correct answer

0 votes

Comments

can you provide the operation history API details (Stream). I need to know count how many change sets delivery happening on the stream daily.

Take a look at this forum link:

https://jazz.net/forum/questions/267038/how-to-get-operationhistory-of-the-stream-programmatically-using-rtc-api


Before posting followup questions, please update if the previous suggested solution worked for you or not. This will help other forum members looking for solutions. Also, search the forum before posting the query.

1 vote

Hello Shashikant,

I am unable to get ChangeHistoryWithBaselinesResult from IWorkspaceConnection object.
I find only IWorkspaceConnection.changeHistory(IComponentHandel). Could you tell me How to I get object of ChangeHistoryWithBaselinesResult ?

The IWorkspaceConnection#fetchChangeHistoryWithBaselines(...) was added in 701. Which version are you using?

We are still using 6.0.6.1 :( 

Hallo Shashikant ,


Could you provide API's which can used for 6.0.6.1 also. it would be great helpful. 

Sorry, I couldn't respond earlier as I was on leave.

You can do the following:
IWorkspaceConnection wsConn = SCMPlatform.getWorkspaceManager(teamRepository).getWorkspaceConnection(workspaceHandle, progress);
IChangeHistory changeHistory = IWorkspaceConnection#changeHistory(componentHandle);
while (changeHistory != null) {
  List<IChangeHistoryEntryChange> recentHistory = changeHistory.recent(null);
  // loop through the recent history list and get the change set handles: IChangeHistoryEntryChange#changeSet() and pass it to the below method
  List<IChangeSet> changeSets = repository.itemManager().fetchCompleteItems(changeSetHandles, IItemManager.DEFAULT, progress);
  // process more in the history
  changeHistory = changeHistory.previousHistory(progress);
}

Hello Shashikant,

Wish you happy new year. Thanks for your earlier comment and support.  From change, trying to find which file was changed. I got stuck in finding file name.
List<IChangeSet> changeSets = repository.itemManager().fetchCompleteItems(changeSetHandles, IItemManager.DEFAULT, progress);
looping each IChangeSet cs from List List<IChangeSet> changeSets and inner loop of  IChange change 
 IVersionable  versionalbe=compConfig.fetchCompleteItem(change.item(), monitor); this line gives me exception. Could you help which object , should use to get IFileItem from Change  object.

IVersionableHandle versionableHandles = new ArrayList<IVersionableHandle>(changeSet.changes().size);
for (IChange change : (List<IChange>) changeSet.changes()) {
    versionableHandles.add(change.afterState());
}

List<IVersionable> versionables = SCMPlatform.getWorkspaceManager(repo).versionableManager().fetchCompleteStates(versionableHandles, monitor);

versionables[i].getName(); // gives you the filename

Thanks a lot for the support, highly appreciate it. Below code worked for me.
for (IChange change : (List<IChange>) changeSet.changes()) {
 IVersionable   versionable= SCMPlatform.getWorkspaceManager(teamRepository).versionableManager().fetchCompleteState(change.afterState(), monitor); 

} 

need to take care for cases when file is deleted/removed from SCM , versionable will be null.

showing 5 of 10 show 5 more comments

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,937
× 7,495
× 1,700
× 1,325
× 382

Question asked: Sep 28 '20, 10:40 a.m.

Question was seen: 1,872 times

Last updated: Jan 13 '21, 8:43 a.m.

Confirmation Cancel Confirm