How to use batchCommit() method of IScmService?
As my requirement to check in multiple unresolved changes/ files into component, is batchCommit() is right choice to do the same? I used "Metronome" to find out which RTC API call during check in multiple files. But I want to do this Java API, Is this possible in Java. If yes please suggest parameters I need to pass batchCommit() method.
Accepted answer
If you are writing a client-side plugin, here's the corresponding API:
ITeamRepository repo = getRepo();
IWorkspaceHandle workspaceHandle = getWorkspace();
IWorkspaceManager wm = ScmPlatform.getWorkspaceManager(repo);
IWorkspaceConnection wc = wm.getWorkspaceConnection(workspaceHandle, monitor);
From here you can use the wc#commit(...) method, but you'd have to specify the change set you want the check-in to go into, and build up the files to check-in.
Comments
@David Lafreniere thanks for your valuable reply, i already used wc.commit() method for checkin single file belo is code
workspace.commit(fChangeSet,Collections
.singletonList(workspace.configurationOpFactory()
.save(file)), monitor);
But I want to check in multiple files, do u have any idea about how can this posiible?
That is the correct API to use when you want to check-in multiple files.
Notice that the 'configOp' argument is actually a Collection. So in your example, you are creating a List of size 1. So all you need to do is add as many IConfigurationOps as you need (i.e. one for each file you want to check-in), that way you make one call to the server.