Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[closed] After undo unresolved changes in local sandbox EWM client require to be repaired!!!

Hi Guys,

After Undoing changes using java API in sandbox EWM need to be repaired to work further with after opening EWM. How can I correctly undo unresolved changes. I did dig all related forum question related to undo changes  until I reach to this solution. but it need  rapair interaction process afterward in EWM. Thank you in advance :).  how can I do  clean undo changeset in plain java  just like scm command : scm.exe repair "BRM Stream Workspace"
p.s. Also resolver0 as in before last line did not work for me so I use resolver to get repository. 

        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);
}

0 votes


The question has been closed for the following reason: "Duplicate Question" by rschoon Jul 26 '22, 8:43 a.m.

Accepted answer

Permanent link

 Duplicate. See https://jazz.net/forum/questions/281079/handle-project-out-of-synch-using-plain-java-api-after-discarding-changeset?page=1&focusedAnswerId=281081#281081

MJ Ranji selected this answer as the correct answer

0 votes

Comments
As I explain on the duplicated link. I only loaded this project once in EWM.

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.   

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 169
× 89
× 9

Question asked: Jul 26 '22, 7:01 a.m.

Question was seen: 833 times

Last updated: Jul 27 '22, 1:57 a.m.

Confirmation Cancel Confirm