How to get all changesets for each single component
Hi all,
i want to get all changesets from a component from the Source Control in RTC.
First i have list all streams and then every component of each single stream.
See the code below:
//List all Stream for each single ProjectArea
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(teamRepository);
IWorkspaceSearchCriteria stcriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
stcriteria.setKind(IWorkspaceSearchCriteria.STREAMS);
stcriteria.setPartialOwnerNameIgnoreCase(projectArea.getName());
List <IWorkspaceHandle> workspaceHandles = workspaceManager.findWorkspaces(stcriteria,Integer.MAX_VALUE,monitor);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandles.get(0),monitor);
System.out.println("Streams: ");
System.out.println(workspaceConnection.getName());
//List all Components for each single ProjectArea
List components = teamRepository.itemManager().fetchCompleteItems(workspaceConnection.getComponents(), IItemManager.DEFAULT, null);
for (Iterator<IComponent> it = components.iterator(); it.hasNext();) {
IComponent component = it.next();
System.out.println("Components: ");
System.out.println(component.getName());
}
List components = teamRepository.itemManager().fetchCompleteItems(workspaceConnection.getComponents(), IItemManager.DEFAULT, null);
for (Iterator<IComponent> it = components.iterator(); it.hasNext();) {
IComponent component = it.next();
System.out.println("Components: ");
System.out.println(component.getName());
}
Now i try to get the changesets of the components. I want to know the changesets after one defined date. I tried the following thing:
IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setModifiedAfter(timestamp); /// the timestamp is for example 01.10.2015
.......need help here.......= workspaceManager.findChangeSets(criteria,512, null);
Is it right? but now i don't know how to handle the changeset. How can i list and view them?
It would be very nice, if someone can help me!
Best Regards!
i want to get all changesets from a component from the Source Control in RTC.
First i have list all streams and then every component of each single stream.
See the code below:
//List all Stream for each single ProjectArea
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(teamRepository);
IWorkspaceSearchCriteria stcriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
stcriteria.setKind(IWorkspaceSearchCriteria.STREAMS);
stcriteria.setPartialOwnerNameIgnoreCase(projectArea.getName());
List <IWorkspaceHandle> workspaceHandles = workspaceManager.findWorkspaces(stcriteria,Integer.MAX_VALUE,monitor);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandles.get(0),monitor);
System.out.println("Streams: ");
System.out.println(workspaceConnection.getName());
//List all Components for each single ProjectArea
List components = teamRepository.itemManager().fetchCompleteItems(workspaceConnection.getComponents(), IItemManager.DEFAULT, null);
for (Iterator<IComponent> it = components.iterator(); it.hasNext();) {
IComponent component = it.next();
System.out.println("Components: ");
System.out.println(component.getName());
}
List components = teamRepository.itemManager().fetchCompleteItems(workspaceConnection.getComponents(), IItemManager.DEFAULT, null);
for (Iterator<IComponent> it = components.iterator(); it.hasNext();) {
IComponent component = it.next();
System.out.println("Components: ");
System.out.println(component.getName());
}
Now i try to get the changesets of the components. I want to know the changesets after one defined date. I tried the following thing:
IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setModifiedAfter(timestamp); /// the timestamp is for example 01.10.2015
.......need help here.......= workspaceManager.findChangeSets(criteria,512, null);
Is it right? but now i don't know how to handle the changeset. How can i list and view them?
It would be very nice, if someone can help me!
Best Regards!
One answer
Hello,
ich found the solution for me:
expanded to my first post:
IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setModifiedAfter(timestamp);
criteria.setComponent(component);
List<IChangeSetHandle> workspacehandle = workspaceManager.findChangeSets(criteria,512, null);
for (Iterator<IChangeSetHandle> changeset = workspacehandle.iterator(); changeset.hasNext();) {
IChangeSetHandle changesethandle = changeset.next();
System.out.println("Changesets: ");
System.out.println(changesethandle.getItemId());
Now i get all Changesets for each single component.
Best Regards!
ich found the solution for me:
expanded to my first post:
IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setModifiedAfter(timestamp);
criteria.setComponent(component);
List<IChangeSetHandle> workspacehandle = workspaceManager.findChangeSets(criteria,512, null);
for (Iterator<IChangeSetHandle> changeset = workspacehandle.iterator(); changeset.hasNext();) {
IChangeSetHandle changesethandle = changeset.next();
System.out.println("Changesets: ");
System.out.println(changesethandle.getItemId());
Now i get all Changesets for each single component.
Best Regards!
Comments
Chris McGee
FORUM MODERATOR / JAZZ DEVELOPER Oct 20 '15, 2:29 p.m.Fetching all of the change sets in a project area and the components can be an expensive operation. What's the purpose here?
Btw, I posted an answer on your other question. Maybe that is helpful with this question?
https://jazz.net/forum/questions/208609/how-to-use-changesets-for-the-last-modification-in-the-source-control-java-api?page=1&focusedAnswerId=209390#209390