ResavePackagesCommandlet Does not Respect -maxpackagetoresave If -batchsourcecontrol Is Set

Hello!

When running the resavepackages commandlet with (this contrived example):

"$(SolutionDir)<your project>.uproject" -run=ResavePackages -AutoCheckOutPackages -SkipCheckedOutPackages -BatchSourceControl -CHECKUE4VER -PROJECTONLY -MAXPACKAGESTORESAVE=1

You will notice that the commandlet ignores MAXPACKAGESTORESAVE and saves all packages that meet the criteria of the rest of the commandline arguments. In this case it will resave all project packages that are not the current UE version.

However if -BatchSourceControl is removed then MAXPACKAGESTORESAVE will be handled correctly and exactly 1 package will be resaved.

The reason for this is because UResavePackagesCommandlet relies on its FQueuedSourceControlOperations member, SourceControlQueue to update the PackagesResaved count if -BatchSourceControl is used. If that option is not used then the commandlet instead uses its member function, LoadAndSaveOnePackage to increment PackagesResaved at the moment a package is resaved.

The problem is 2 things:

  1. Main() needs to check the number of pending saves in SourceControlQueue while its iterating through the packages to be resaved
  2. Main() can’t do that check because FQueuedSourceControlOperations does not provide a getter for its PendingCheckoutFiles.Num(). There is a HasPendingOperations() function but that is too broad.

I believe the fix is to provide a NumPendingResaveOperations() function in FQueuedSourceControlOperations and use it to set PackagesResaved (or create a new variable PendingPackagesToResave) in UResavePackageCommandlet::Main() in ContentCommandlets.cpp, line 1422.

[Image Removed]

I’m leaving a note here in case there are reasons inside UE’s commandlet source control handling to not do this. If it’s all good, then this is also a request to get it into the next release of UE.

Thanks!

Hi,

Thank you for the above information.

Of potential note is the additional ‘BatchPackageLimit’ and ‘BatchFileSizeLimit’ flags that are parsed when the -BatchSourceControl flag is present. If the ‘BatchPackageLimit’ flag is omitted the batch size is unbound which may supersede the MAXPACKAGESTORESAVE flag.

Are you please able to provide information on how you have verified the described behavior and/or detailed steps to reproduce the issue you have reported. This will help to determine what the next steps should be taken and will aid in any potential bug reports.

Kind Regards