Просмотр исходного кода

sync: Only parallelize gc for git >= 1.7.2

This minimum version is required for the -c argument to set config on
the command line. Without this option, git by default uses as many
threads per invocation as there are CPUs, so we cannot safely
parallelize without hosing a system.

Change-Id: I8fd313dd84917658162b5134b2d9aa34a96f2772
Dave Borowitz 13 лет назад
Родитель
Сommit
e21526754b
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      subcmds/sync.py

+ 3 - 2
subcmds/sync.py

@@ -44,7 +44,7 @@ try:
 except ImportError:
 except ImportError:
   multiprocessing = None
   multiprocessing = None
 
 
-from git_command import GIT
+from git_command import GIT, git_require
 from git_refs import R_HEADS, HEAD
 from git_refs import R_HEADS, HEAD
 from main import WrapperModule
 from main import WrapperModule
 from project import Project
 from project import Project
@@ -310,7 +310,8 @@ later is required to fix a server side protocol bug.
     return fetched
     return fetched
 
 
   def _GCProjects(self, projects):
   def _GCProjects(self, projects):
-    if multiprocessing:
+    has_dash_c = git_require((1, 7, 2))
+    if multiprocessing and has_dash_c:
       cpu_count = multiprocessing.cpu_count()
       cpu_count = multiprocessing.cpu_count()
     else:
     else:
       cpu_count = 1
       cpu_count = 1