It's all about the answers!

Ask a question

removing orphan snapshots using java api


K M (38325251) | asked Jan 24 '11, 1:25 p.m.
retagged Dec 10 '13, 11:44 a.m. by David Lafreniere (4.8k7)
I used
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
wm.deleteWorkspace(workspace, MONITOR);

to remove a workspace with snapshots.......now I can not rid of the snapshots

I get the following error

ERROR: CRJAZ0215I Item not found: com.ibm.team.scm.common.internal.impl.WorkspaceHandleImpl@2e8c2e8c (stateId: <unset>, itemId: , origin: <unset>, immutable: <unset>)


anybody have ideals to do this??

Comments
K M commented Dec 09 '13, 9:24 a.m. | edited Dec 09 '13, 1:24 p.m.

Does anybody know how to find orphan snapshots?

One answer



permanent link
David Lafreniere (4.8k7) | answered Dec 10 '13, 11:42 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 10 '13, 11:43 a.m.
Note: To remove the snapshots before deleting the workspace, call the following:
IWorkspaceConnection.removeBaselineSet(IBaselineSetHandle baselineSet, IProgressMonitor monitor)

If you have the IWorkspaceHandle of the workspace that owns the snapshots, you can find all snapshots that have that as the owner using IBaselineSetSearchCriteria (IBaselineSetSearchCriteria has methods to scope the query further).

Ex:
IWorkspaceHandle wsHandle = null // GET ME SOMEHOW
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo);
IBaselineSetSearchCriteria criteria = IBaselineSetSearchCriteria.FACTORY.newInstance();
criteria.setOwnerWorkspaceOptional(wsHandle);
List snapshotHandles = workspaceManager.findBaselineSets(criteria, MAX_TO_SHOW, null);
// snapshotHandles contains a list of IBaselineSetHandle, so you can fetch them as normal from there...

Your answer


Register or 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.