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

Local projects out of sync after workspaceConnection.deliver

I have written an IOperationAdvisor which acts as a precondition to the Deliver operation. The advisor examines the file contents and if a certain chunk of text is missing, the advisor will modify the file and commit and deliver this to the repository workspace.

This is all working fine except for the fact that the local resources are out of sync when the deliver action completes. This, too, makes sense since I'm changing the file content "behind the scenes" when the user invokes the Deliver action.

So the question: is there a way for me to programatically resynchronize these files that my operation advisor has modified?

fileItem.setContent(...);
fileItem.setFileTimestamp(new Date());

IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo);
Collection<IShareable> shareables = FileSystemCore.getSharingManager().findShareables(fileItem, monitor);
IShareable shareable = shareables.iterator().next().getShare(monitor).getSharingDescriptor();

IWorkspaceHandle ws = (IWorkspaceHandle) sd.getConnectionHandle();
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(ws, null);

workspaceConnection.commit(curHandle, Collections.singletonList(workspaceConnection.configurationOpFactory().save(fileItem)), monitor);

IChangeHistorySyncReport sync = workspaceConnection.compareTo(workspaceConnection, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY,
Collections.EMPTY_LIST, monitor);
workspaceConnection.deliver(workspaceConnection, sync, Collections.EMPTY_LIST, sync.outgoingChangeSets(changeSet.getComponent()), monitor);

0 votes



2 answers

Permanent link
We have a similar advisor in RTC (copyright advisor) but it does not do automatic delivery because of the many possible complications. What the copyright advisor does is fail the deliver and provide a quick fix in the Team Advisor view that, when chosen by the user, updates the text accordingly. Then the user can check-in the changes either into an existing change set or a new one if all the existing change sets are complete.

The reason it is not done automatically is because of the change set handling. If the file in question is in an active change set, then the advisor would need to make the local change and check it in to that active change set. However, it is possible that the change set is complete, in which case, the advisor would need to either check the file into a different active change set or create a new change set. I think it would be fairly easy for the advisor to do the wrong thing in these cases so I think you would be better off using the same approach as the copyright advisor.

0 votes


Permanent link
Michael,

That's exactly what I was looking for. Thanks for your reply.

0 votes

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

Question asked: Jan 26 '11, 12:59 p.m.

Question was seen: 5,999 times

Last updated: Jan 26 '11, 12:59 p.m.

Confirmation Cancel Confirm