How do you accept change sets into the local (filesystem) workspace using the Java API?
I'm using RTC 3.0.1 and the Java APIs. I've traversed them to the point that I can identify all incoming change sets (the basic flow, for others who are interested, is to search for a named workspace using workspace manager; then get the use the IFlowTable to get the current accept flow; then compare these two IWorkspaceConnection objects to produce an IChangeHistorySyncReport).
I can even accept these incoming change sets using IWorkspaceConnection.accept. However, I need to be able to update the local filesystem with these change sets as well. So I need to be able to take these incoming change sets and update the workspace on my computer's local filesystem with them.
Does anyone know how I can do so?
I can even accept these incoming change sets using IWorkspaceConnection.accept. However, I need to be able to update the local filesystem with these change sets as well. So I need to be able to take these incoming change sets and update the workspace on my computer's local filesystem with them.
Does anyone know how I can do so?
2 answers
Is there a reason you want to implement this with the plan Java API? You could make a call to the CLI to have it change flow target and accept a change set in order to update what you have loaded. There's quite a bit of code in the clients that process the changes to a workspace that would affect your sandbox. It decides which items need to be updated and gets the new content.
You could do it yourself and I think IVersionedContentManager would be a starting point. You can look at the IUpdateReport from the accept and determine which files you'll need to update. Get the IFileItem for each file and get the IVersionedContent so you can use the IVersionedContentManager to retrieve the file.
You could do it yourself and I think IVersionedContentManager would be a starting point. You can look at the IUpdateReport from the accept and determine which files you'll need to update. Get the IFileItem for each file and get the IVersionedContent so you can use the IVersionedContentManager to retrieve the file.
Comments
I found this old post trying to understand what you must do after accepting change sets or baseline when you're working on a specific sandbox via java api and you want to refresh sandbox associated filesystem
I used
com.ibm.team.filesystem.client.internal.operations.UpdateOperation.UpdateOperation(IWorkspaceConnection, List<IUpdateReport>, int, UpdateDilemmaHandler, IDownloadListener)
in this way
IFileSystemOperation fileSystemOperation = new UpdateOperation( workspaceConnection, updateReports, UpdateOperation.PROCESS_ALL_UPDATES, WorkspaceUpdateDilemmaHandler.getDefault(), downloadListener);
...
fileSystemOperation.run(progressMonitor);but I don't get if this is similar of what has been suggested by Tim Mok. By the way it works for me....