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

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.

0 votes


Accepted answer

Permanent link
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

1 vote

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.

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,937
× 7,495

Question asked: Jan 22 '19, 12:57 a.m.

Question was seen: 1,674 times

Last updated: Jan 23 '19, 8:04 a.m.

Confirmation Cancel Confirm