Merge default tip
authorJan Vrany <jan.vrany@labware.com>
Thu, 28 Jul 2022 06:56:07 +0100
changeset 943 442fe77c421f
parent 942 2368b49c865d (current diff)
parent 941 c1c82be6b3bb (diff)
Merge
--- a/mercurial/HGCommand.st	Mon May 30 13:55:20 2022 +0100
+++ b/mercurial/HGCommand.st	Thu Jul 28 06:56:07 2022 +0100
@@ -2793,6 +2793,13 @@
     "Modified: / 23-10-2012 / 11:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+sizeWithSeparatorCharacters: fileSize
+    "/ +2...quotes around filename; +1...for space between files  
+    ^ fileSize + 2 + 1
+
+    "Created: / 07-06-2022 / 12:39:22 / Patrik Svestka <patrik.svestka@gmail.com>"
+!
+
 splitIntoPartitions: pathsToBeSplit
     "Splits file names into partitions that can be executed"
     | base currentSize baseLimit limit pathsPartitions  |
@@ -2811,23 +2818,22 @@
     pathsPartitions := OrderedCollection new.
     pathsPartitions add: OrderedCollection new. "/ init Collection
     
-    pathsToBeSplit inject: 0 into: [ :filenamesSize :eachFile |
-        "/ +2...for quotes around every file; +1...for space between files
-        currentSize := filenamesSize + eachFile size + 2 + 1.
+    pathsToBeSplit inject: 0 into: [ :totalFilenamesSize :eachFile |
+        currentSize := totalFilenamesSize + (self sizeWithSeparatorCharacters: (eachFile size)).
         currentSize >= limit ifTrue: [                
             pathsPartitions add: OrderedCollection new.
             " Next partition limit.  Must subtract a portion of a file name size which 
               fits partially in the previous partititon, otherwise the next partition 
-              will be too large.   Subtracting also 2 quotes and 1 space for worst case scenario.                                                                  
+              will be too large. Subtracting also 2 quotes and 1 space for worst case scenario.                                                                  
               limit := limit + baseLimit - ((eachFile size + 2 + 1) - (currentSize - limit)) simplified: "
-            limit := baseLimit + currentSize - (eachFile size + 2 + 1)            
+            limit := baseLimit + currentSize - (self sizeWithSeparatorCharacters: (eachFile size))
         ].
         (pathsPartitions last) add: eachFile.
         currentSize
     ].
     ^ pathsPartitions
 
-    "Modified (comment): / 27-05-2022 / 09:52:45 / Patrik Svestka <patrik.svestka@gmail.com>"
+    "Modified: / 08-06-2022 / 14:07:12 / Patrik Svestka <patrik.svestka@gmail.com>"
 ! !
 
 !HGCommand::status methodsFor:'queries'!