How to get the snapshot handle via Java API?
I should modify the build definition using the last day snapshot.
I know the snapshot name, and how can I get the snapshot handle?
Thanks!
|
2 answers
I don't know, but this would probably be in the build toolkit
|
The following code can work:
There is no snapshot class, instead of IBaselineSet
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
IItemQueryPage itemQueryPage = wm.findWorkspacesByName(stream, true,
true, false, 2, monitor);
if (itemQueryPage.getSize() == 0) {
return null;
}
IWorkspaceHandle workspaceHandle = (IWorkspaceHandle) itemQueryPage
.getItemHandles().get(0);
IWorkspaceConnection connection = null;
if (connection == null) {
connection = SCMPlatform.getWorkspaceManager(repo).getWorkspaceConnection(workspaceHandle, null);
connection.getName();
}
List<IBaselineSetHandle> handles = connection.getBaselineSets(null);
handles.size();
List<IBaselineSet> items = connection.teamRepository().itemManager().fetchCompleteItems(handles, IItemManager.DEFAULT, null);
for(int i=0;i<items.size();i++){
System.out.println(items.get(i).getName());
}
|
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.