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 {
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());
}
}
}
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.
Please mark as accepted if this solves your task,
- Arne
Comments
Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 01 '17, 12:24 a.m.1 vote
Jazzuser user
Jun 01 '17, 2:13 a.m.Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 01 '17, 3:02 p.m.1 vote