How to get the Changesets linked to a particular snapshot ?
Hello All,
I have a usecase wherein, given a snapshot as an input, I should get all the linked Changesets linked to it. Is there any way i can get the changeSet details ? Or what is the order in which i will get the changeSet details ?
What are the different ways of getting the changesets ?
Please advice.
Thanks.
Accepted answer
Hello Jazzuser,
this is a sample of how to get the change sets:
I assume you already managed to obtain the snapshot as
IBaselineSet snapshot
Get list of baselines --> get change sets (need temp workspace to resolve history):
List<IChangeSetHandle> changesetList = new ArrayList<IChangeSetHandle(); IWorkspaceConnection tempWSConnection = SCMPlatform .getWorkspaceManager(teamRepository).createWorkspace( currentUser, name, comment, snapshot, null); List<IBaseline> baselineList = snapshot.getBaselines(); for (IBaseline bl : baselineList {This way you get all change sets in snapshots baselines history but it can take a bit of time as this is a paging approach.
IComponentHandle componentHandle = currentBL.getComponent(); IChangeHistory changeHistory;
changeHistory = tempWSConnection.changeHistory(componentHandle); List<IChangeHistoryDescriptor> csDescriptorList; csDescriptorList = changeHistory
.getHistoryDescriptors(Integer.MAX_VALUE, false, null);
for (IChangeHistoryDescriptor csDescriptor : csDescriptorList) {
List<IChangeHistoryEntryChange> csList = csDescriptor.recent();
for (final IChangeHistoryEntryChange currentEntry : csList) {
changeSetList.add(currentEntry.changeSet());
}
}
}
Please mark as accepted if this solves your task,
- Arne
Comments
Hello Arne..
as per ur sample code, we created the temporary WorkSpace. but we need to delete the Workspace created after the execution of our logic.
Code for temp WS creation :
IWorkspaceConnection wrkspaceCon=workspaceMgr.createWorkspace(scopeHandle, "testStreamDemoPurpose2", "forTestingpurpsose", snapShot, null);
we create the workspace the above way.
Is there any way to delete this IWorkspaceConnection object ?
Try this:
SCMPlatform.getWorkspaceManager(teamRepository).deleteWorkspace(
workspaceHandle, null);
Comments
Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 01 '17, 12:24 a.m.To confirm, by "change sets linked to it", do you mean "the set of change sets that are in the history of the baselines that make up the snapshot"?
1 vote
Jazzuser user
Jun 01 '17, 2:13 a.m.Thanks a lot for the reply Geoffrey, Yes you are right, it is "the set of change sets that are in the history of the baselines that make up the snapshot:.
We are programmatically doing it, so we are looking for an API.
Is there any API to this ? could you please share sample code if any. This would help me alot.
Thank you.
Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 01 '17, 3:02 p.m.I'll have to defer to others on the forum for the API pointers. If using the command line is acceptable, I'd take a look at the scm command to see if it gives you what you need.
1 vote