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

Getting and accepting incoming change sets via Java API

 Hi all,

I want to write an Eclipse Plugin with a command to check and accept incoming change sets one by one using the Java API in RTC 5.0.2.

This is what I have so far:

for (IComponentHandle componentHandle : components) {

try {

IComponent component = (IComponent) itemManager.fetchCompleteItem(componentHandle, IItemManager.DEFAULT, new NullProgressMonitor());

consoleOut.println("Processing component " + component.getName());

IChangeSetSourcesPage changeSetPage = conn.fetchFromAcceptQueue(component, 0, 500,

new NullProgressMonitor());


processChangeSets(changeSetPage.getChangeSetSources());


while (changeSetPage.hasNextPage()) {

changeSetPage = conn.fetchFromAcceptQueue(changeSetPage.getPageDescriptor(),

new NullProgressMonitor());

processChangeSets(changeSetPage.getChangeSetSources());

}

} catch (TeamRepositoryException e) {

consoleOut.println("Error while getting change sets: " + e.getMessage());

e.printStackTrace();

}

}


But, somehow, fetchFromAcceptQueue() seems not to be what I am looking for. Because, the above code works without throwing an exception, but always returns zero change sets, even though my workspace shows incoming change sets in the "Pending Changes" view. Is there another method I should be using?

0 votes


Accepted answer

Permanent link
fetchFromAcceptQueue() is specific to the new merge-gaps workflow: a component in a workspace can be in a conflicted state where it has a gap, and a number of items to merge into it. The fetch looks like it pulls the next change set that is to be merged. Using our API is a bit more complex: you need to compare the the workspace and its flow target, then run an accept on it.

In general, I suggest using the CLI: either run 'scm accept' to grab all of the change sets that are incoming, or use 'scm show status' to get a listing of the incoming changes so you can cherry pick the ones you want.

If you have your heart set on using the Java API, I suggest you explore IFlowNodeConnection.compareTo() which will provide you with the differences between the workspace/stream then use com.ibm.team.filesystem.client.IOperationFactory.getWorkspaceUpdateOperation() to get an operation that will do the accept for you. So long as the sandbox(es) of the loaded workspace have been registered, they will be updated during the accept.
David Lafreniere selected this answer as the correct answer

1 vote

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,938
× 411
× 149
× 19

Question asked: Dec 01 '14, 10:10 a.m.

Question was seen: 5,100 times

Last updated: Aug 02 '16, 8:00 p.m.

Confirmation Cancel Confirm