Subversion Plugin Add Files doesn't work

I found an issue where if you attempt to add a large number of files (anything over 50) from a folder, not all of the files get added. It also causes subsequent issues when you try to do checkins (checkins either go slowly or don’t complete at all).

It is related to an error in the SubversionSourceControlUtils.cpp in the Subversion Source Control Plugin. The code attempts to perform operations on files in batches (I believe the max batch size if 50). The version of the code in lines 260-263 on 4.17.1 looks like this:

			for(int32 FileIndex = 0; FileIndex < InFiles.Num() && FileIndex < SubversionSourceControlConstants::MaxFilesPerBatch; FileIndex++, FileCount++)
			{
				FilesInBatch.Add(InFiles[FileIndex]);

To make it work it should look like this:

			for(int32 FileIndex = 0; FileCount < InFiles.Num() && FileIndex < SubversionSourceControlConstants::MaxFilesPerBatch; FileIndex++, FileCount++)
			{
				FilesInBatch.Add(InFiles[FileCount]);
			}

You can note that would make it consistent with portion of a variant of the RunCommand(*) method on lines 206-209 that does work.

You can easily reproduce the problem using the following steps:

  • create any default project using the starter content (I called mine TestRepo)
  • create a corresponding, empty SVN repository called TestRepo
  • check the empty TestRepo into your project so there is a .svn file in your project root folder
  • connect to source control using the credentials for the repo you set up
  • click on StarterContent in the Content folder, attempt to add it to source control
  • after the operation is complete, you’ll see that only some of the files have a + sign; you can verify the same using a commandline client or TortoiseSVN
  • if you watch the log files, you’ll notice that with the code as-written, it attempts to add the same batch of 50 files through each iterate of the loop