It's all about the answers!

Ask a question

removing orphan snapshots using java api

K M (38325051) | 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 I can not rid of the snapshots

I get the following error

ERROR: CRJAZ0215I Item not found: (stateId: <unset>, itemId: , origin: <unset>, immutable: <unset>)

anybody have ideals to do this??

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.
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).

IWorkspaceHandle wsHandle = null // GET ME SOMEHOW
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo);
IBaselineSetSearchCriteria criteria = IBaselineSetSearchCriteria.FACTORY.newInstance();
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.