How do you accept change sets into the local (filesystem) workspace using the Java API?
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
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'm hoping to write an Ant task to automate the extraction of change sets to a build machine. I guess I could invoke the CLI from an exec runtime call, though there may be further limitations in that route. And, I don't actually know anything about the CLI.
com.ibm.team.filesystem.client.internal.operations.UpdateOperation.UpdateOperation(IWorkspaceConnection, List<IUpdateReport>, int, UpdateDilemmaHandler, IDownloadListener)
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....
Comments
I think that the difference between the solution proposed by Tim and your solution is that Tim is referring to public API in RTC SDK while your solution is based on internal API (see the package path of UpdateOperation). While you can use this API, the dev team might not support this API in the future. According to Tim (if I understand correctly), there's a need to write allot of "public API" code in order to be aligned with the code triggered by the RTC client which deals with accept operation.