It's all about the answers!

Ask a question

How to check in multiple files in workspace using IScmService or using plain java api?


Andrew Ciaz (273) | asked Jan 23, 5:59 a.m.

 Currently I am succeeded to check in single file in workspace , but I want to check in multiple files using batchCommit() or commit() method. Does anyone have idea of how to commit/check in multiple files using client side api/plain java api?

Accepted answer


permanent link
Ralph Schoon (55.1k23642) | answered Jan 23, 6:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I have published what I know about this API and here this is done: https://rsjazz.wordpress.com/2013/10/15/extracting-an-archive-into-jazz-scm-using-the-plain-java-client-libraries/


The files are in a zip file, but that should be irrelevant.

Ralph Schoon selected this answer as the correct answer

Comments
Andrew Ciaz commented Jan 23, 6:53 a.m.

 Hi @Ralph Schoon thanks for your valuable answer...I already tried this but it has multiple calls of commit() for each file, but while I am checking "Metronome" to check API call by eclipse client, eclipse call method batchCommit(), it commit and save no.of files in single shot. Do you have any idea about how to use this batchCommit() or how to check in multiple files in single shot?


Ralph Schoon commented Jan 23, 7:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If I would want to know how  batchCommit() works, I would use a development environment set up according to the RTC Extensions Workspace and then use the Eclipse Java Search to search for the usage of the method batchCommit(). 

One other answer



permanent link
David Lafreniere (4.1k7) | answered Jan 23, 3:49 p.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. Note: this method has an argument called 'configOp' that is a Collection of IConfigurationOps. So you first create a new List<IConfigurationOps>, then iterate across the files (IVersionable) you want to check-in, call this: wc.configurationOpFactory().save(versionable);  and then add that return result to your 'configOp' collection, then make the wc#commit(...) API call.

Your answer


Register or to post your answer.