diff options
author | Dave Borowitz <dborowitz@google.com> | 2012-10-31 12:24:38 -0700 |
---|---|---|
committer | Dave Borowitz <dborowitz@google.com> | 2012-10-31 12:27:17 -0700 |
commit | e21526754be58523c673d29731ee01d80e0ffc31 (patch) | |
tree | da87019198b421827c9e3cbaecce88077fb76caa /subcmds/sync.py | |
parent | 1d947b30342163b723c96db563967323535fef45 (diff) | |
download | git-repo-e21526754be58523c673d29731ee01d80e0ffc31.tar.gz |
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
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 8e9477a3..15f69f7b 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -44,7 +44,7 @@ try: | |||
44 | except ImportError: | 44 | except ImportError: |
45 | multiprocessing = None | 45 | multiprocessing = None |
46 | 46 | ||
47 | from git_command import GIT | 47 | from git_command import GIT, git_require |
48 | from git_refs import R_HEADS, HEAD | 48 | from git_refs import R_HEADS, HEAD |
49 | from main import WrapperModule | 49 | from main import WrapperModule |
50 | from project import Project | 50 | from project import Project |
@@ -310,7 +310,8 @@ later is required to fix a server side protocol bug. | |||
310 | return fetched | 310 | return fetched |
311 | 311 | ||
312 | def _GCProjects(self, projects): | 312 | def _GCProjects(self, projects): |
313 | if multiprocessing: | 313 | has_dash_c = git_require((1, 7, 2)) |
314 | if multiprocessing and has_dash_c: | ||
314 | cpu_count = multiprocessing.cpu_count() | 315 | cpu_count = multiprocessing.cpu_count() |
315 | else: | 316 | else: |
316 | cpu_count = 1 | 317 | cpu_count = 1 |