Bug 1410938 - Split the clang-format calls into batches of 200 files r?gps
MozReview-Commit-ID: 3cH295RBcv3
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -338,28 +338,35 @@ class FormatProvider(MachCommandBase):
args = [clang_format, "-i"]
path_list = self.generate_path_list(paths)
if path_list == []:
return
- args += path_list
+ print("Processing %d file(s)..." % len(path_list))
+
+ batchsize = 200
- # Run clang-format
- cf_process = Popen(args)
+ for i in range(0, len(path_list), batchsize):
+ l = path_list[i: (i + batchsize)]
+ # Run clang-format on the list
+ cf_process = Popen(args + l)
+ # Wait until the process is over
+ cf_process.communicate()[0]
+
if show:
# show the diff
if self.repository.name == 'hg':
- cf_process = Popen(["hg", "diff"] + path_list)
+ cf_process = Popen(["hg", "diff"] + paths)
else:
assert self.repository.name == 'git'
- cf_process = Popen(["git", "diff"] + path_list)
- return cf_process.communicate()[0]
+ cf_process = Popen(["git", "diff"] + paths)
+ cf_process.communicate()[0]
def mozregression_import():
# Lazy loading of mozregression.
# Note that only the mach_interface module should be used from this file.
try:
import mozregression.mach_interface
except ImportError: