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

How to get unresolved changes of a repository workspace using java API

We are able to get the OutgoingChangeSets using the below code. But is there a way to find the unresolved changes of the workspace?

      IChangeHistorySyncReport changeHistorySyncReport =
          repositoryWorkspcaeConnection.compareTo(streamConnection,
              WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY, Collections.EMPTY_LIST, monitor);

      List<IChangeSetHandle> outgoingChangeSets = changeHistorySyncReport.outgoingChangeSets();

Thanks.

0 votes



One answer

Permanent link
Note:
None of the Filesystem client layer is official API.
You can use it, but per non-API, it is subject to change at any time.

For example, here is a snippet of code that might help.

    protected boolean hasUncheckedInChangesInWorkspace(IProgressMonitor monitor) {
        boolean uncheckedInChangesExist = false;
        IWorkspace workspace = getWorkspace();
        if (workspace != null) {
            ILocalChangeManager lcm = FileSystemCore.getSharingManager().getLocalChangeManager();
            ISharingManager sm = FileSystemCore.getSharingManager();
            Collection<ISandbox> sandboxes = sm.getRegisteredSandboxes();
            SubMonitor subMonitor = SubMonitor.convert(monitor, sandboxes.size());
            outter: for (ISandbox sandbox : sandboxes) {
                Collection<? extends IConfigurationDescriptor> loadedComponents = null;
                try {
                    loadedComponents = sandbox.allLoadedConfigurations(subMonitor.newChild(1));
                } catch (FileSystemException exception) {
                    // TODO log exception
                }
                for (IConfigurationDescriptor loaded : loadedComponents) {
                    if (loaded.getConnectionHandle() instanceof IWorkspaceHandle) {
                        IComponentHandle component = loaded.getComponentHandle();
                        ILocalChange[] localChanges = lcm.getPendingChanges(workspace, component, sandbox);
                        if (localChanges.length > 0) {
                            uncheckedInChangesExist = true;
                            break outter;
                        }
                    }
                }
            }
        }
        return uncheckedInChangesExist;
    }


0 votes

Comments
 Many Thanks for your reply!
Since our code is running with the help of plain java server API’s  and not the eclipse plugin setup, the pending changes are not been retrieved and it always end with the error message: “org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array”

Also, we have figured out that the error message is coming from : com.ibm.team.filesystem.client.internal.localchanges.LocalChangeManager
   @Override
   public ILocalChange[] getPendingChanges(IContextHandle connection,IComponentHandle component, ISandbox sandbox) {
  LocalChangeTracker tracker = findTracker(connection, component, sandbox.getRoot());
if (tracker == null)
{
return NO_CHANGES;  // control returns from here.
}
return tracker.getPendingChanges();
}

Let us know if we are missing anything here. Thanks.

Nope, you're not missing anything. Take a look at the Java package that ILocalChangeManager is in, which is: "com.ibm.team.filesystem.client". I.e. all this code is client-side code. The server does not know about these 'unresolved' changes (which is a client-side concept).

I would like to put my question in other way. Do we have any API which gives us the files which are modified and are not yet checked-in.

"Pending local changes" or "Unresolved changes" or "files which are modified and are not yet check-in" are all the same thing. There is the API I mentioned above, but this API is client-side API. The server has no concept of this and thus there is no API on the server.

Your answer

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

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
× 10,927

Question asked: Oct 12 '18, 8:10 a.m.

Question was seen: 2,407 times

Last updated: Oct 23 '18, 9:53 a.m.

Confirmation Cancel Confirm