@@ -253,37 +253,38 @@ private String getBranchName(String branchName) {
253
253
}
254
254
255
255
@ Override
256
- public VCSCommit setFilesContent (String branchName , List <String > filePathes , List < String > contents , String commitMessage ) {
257
- if (filePathes .isEmpty ()) {
256
+ public VCSCommit setFileContent (String branchName , List <VCSChangeListNode > vcsChangeList ) {
257
+ if (vcsChangeList .isEmpty ()) {
258
258
return null ;
259
259
}
260
260
try (IVCSLockedWorkingCopy wc = repo .getVCSLockedWorkingCopy ()) {
261
261
checkout (getBranchUrl (branchName ), wc .getFolder (), null );
262
- int contentId = 0 ;
263
- for (int filePathId = 0 ; filePathId < filePathes . size (); filePathId ++ ) {
264
- String filePath = filePathes . get ( filePathId );
262
+ StringBuilder commitMessageSB = new StringBuilder () ;
263
+ for (VCSChangeListNode vcsChangeListNode : vcsChangeList ) {
264
+ String filePath = vcsChangeListNode . getFilePath ( );
265
265
File file = new File (wc .getFolder (), filePath );
266
266
Boolean needToAdd = !file .exists ();
267
267
if (needToAdd ) {
268
268
FileUtils .forceMkdir (file .getParentFile ());
269
269
file .createNewFile ();
270
270
}
271
271
272
- String content = contents .get (contentId );
273
- FileWriter writer = new FileWriter (file );
274
- writer .write (content );
275
- writer .close ();
276
- contentId ++;
277
-
272
+ try (FileWriter writer = new FileWriter (file )) {
273
+ writer .write (vcsChangeListNode .getContent ());
274
+ }
275
+
278
276
if (needToAdd ) {
279
277
clientManager
280
278
.getWCClient ()
281
279
.doAdd (file ,
282
280
true /* force, avoiding "file is already under version control" exception */ ,
283
281
false , false , SVNDepth .EMPTY , false , true );
284
282
}
283
+ commitMessageSB .append (vcsChangeListNode .getLogMessage () + VCSChangeListNode .COMMIT_MESSAGES_SEPARATOR );
285
284
}
286
285
286
+ commitMessageSB .setLength (commitMessageSB .length () - VCSChangeListNode .COMMIT_MESSAGES_SEPARATOR .length ());
287
+ String commitMessage = commitMessageSB .toString ();
287
288
try {
288
289
SVNCommitInfo newCommit = clientManager
289
290
.getCommitClient ()
@@ -304,7 +305,7 @@ public VCSCommit setFilesContent(String branchName, List<String> filePathes, Lis
304
305
305
306
@ Override
306
307
public VCSCommit setFileContent (String branchName , String filePath , String content , String commitMessage ) {
307
- return setFilesContent (branchName , Collections .singletonList (filePath ), Collections . singletonList ( content ) , commitMessage );
308
+ return setFileContent (branchName , Collections .singletonList (new VCSChangeListNode ( filePath , content , commitMessage )) );
308
309
}
309
310
310
311
@ Override
0 commit comments