[closed] After undo unresolved changes in local sandbox EWM client require to be repaired!!!
Hi Guys,
List<IWorkspaceHandle> workspaceHandles = ...
IWorkspaceHandle wh = workspaceHandles.get(0);
ArrayList<String> target = getAvailableComponentPath(); //like JKEJAVAUI, JKEBUSSINESLOGIC
FileSystemCore.startUp();
ISharingManager sm = FileSystemCore.getSharingManager();
ILocalChangeManager lcm = sm.getLocalChangeManager();
PathLocation pathlocation = new PathLocation(sandBoxLocation);
ILocation sandBoxLocation = pathlocation.getCanonicalForm();
String[] targetPaths = new String[target.size()];
targetPaths = target.toArray(targetPaths);
for (int i = 0; i < targetPaths.length; i++) {
ISandbox sbox = sm.getSandbox(sandBoxLocation, false);
IRelativeLocation relativeLocation = new RelativeLocation(
Arrays.asList(targetPaths[i]));
IShareable shareable = sbox.findShareable(relativeLocation,
ResourceType.FOLDER);
lcm.refreshChanges(new ISandbox[] { sbox },
RefreshType.TRAVERSE_ALL_WITH_RECOMPUTE_OF_KNOWN, null);
ILocalChange[] localChanges = lcm.getPendingChanges(
new IShareable[] { shareable }, null);
IRepositoryResolver resolver = new IRepositoryResolver() {
public ITeamRepository getRepoFor(String uri, UUID id) {
// Return the repository to be used
return repo;
}
};
if (localChanges.length > 0) {
IRepositoryResolver resolver0 = IRepositoryResolver.EXISTING_SHARED; //This one did not work
lcm.undoChanges(localChanges, resolver, true, null, monitor);
}
The question has been closed for the following reason: "Duplicate Question" by rschoon Jul 26 '22, 8:43 a.m.
Accepted answer
Comments
Do you mean requirement to repair local workspace after undoing changes is because of parallel load of workspace? if that is the case then you can mark this question as duplicate else I'll need to know my mistake in the code that lead to repair message in EWM client hence not duplicated question. But the thing is that I have loaded this repository workspace only once in my local workspace(sandbox)!
Thanks in advance
It does not matter how often you load the repository workspace, if you mess with the API. The repository workspace tracks the state of the files on the server and on the sandbox. If you load the repo workspace once and then update the server files using the API, the one loaded repo workspace detects the discrepancy between the sandbox and the repo workspaces and tells you they are out of sync.