It's all about the answers!

Ask a question

How to use batchCommit() method of IScmService?


Andrew Ciaz (59160) | asked Jan 22 '19, 12:57 a.m.

 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


permanent link
David Lafreniere (4.8k7) | answered Jan 22 '19, 10:42 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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.


Ralph Schoon selected this answer as the correct answer

Comments
Andrew Ciaz commented Jan 23 '19, 5:35 a.m.

 @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?


David Lafreniere commented Jan 23 '19, 8:04 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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.

Your answer


Register or 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.