Disabled threaded index-pack for known difficult repositories.

BUG=349576
R=mmoss@google.com

Review URL: https://codereview.chromium.org/210063005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@259164 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
szager@chromium.org
2014-03-25 06:02:08 +00:00
parent bda475e2f8
commit ff11329dfa
2 changed files with 17 additions and 6 deletions

View File

@@ -255,7 +255,7 @@ class GitWrapper(SCMWrapper):
quiet = ['--quiet']
self._UpdateBranchHeads(options, fetch=False)
cfg = gclient_utils.DefaultIndexPackConfig()
cfg = gclient_utils.DefaultIndexPackConfig(self.url)
fetch_cmd = cfg + ['fetch', self.remote, '--prune']
self._Run(fetch_cmd + quiet, options, retry=True)
self._Run(['reset', '--hard', revision] + quiet, options)
@@ -725,7 +725,7 @@ class GitWrapper(SCMWrapper):
print('')
template_path = os.path.join(
os.path.dirname(THIS_FILE_PATH), 'git-templates')
cfg = gclient_utils.DefaultIndexPackConfig()
cfg = gclient_utils.DefaultIndexPackConfig(self.url)
clone_cmd = cfg + [
'clone', '--no-checkout', '--progress', '--template=%s' % template_path]
if self.cache_dir:
@@ -937,7 +937,7 @@ class GitWrapper(SCMWrapper):
'^\\+refs/branch-heads/\\*:.*$']
self._Run(config_cmd, options)
if fetch:
cfg = gclient_utils.DefaultIndexPackConfig()
cfg = gclient_utils.DefaultIndexPackConfig(self.url)
fetch_cmd = cfg + ['fetch', self.remote]
if options.verbose:
fetch_cmd.append('--verbose')

View File

@@ -30,6 +30,14 @@ RETRY_INITIAL_SLEEP = 0.5
_WARNINGS = []
# These repos are known to cause OOM errors on 32-bit platforms, due the the
# very large objects they contain. It is not safe to use threaded index-pack
# when cloning/fetching them.
THREADED_INDEX_PACK_BLACKLIST = [
'https://chromium.googlesource.com/chromium/reference_builds/chrome_win.git'
]
class Error(Exception):
"""gclient exception class."""
def __init__(self, msg, *args, **kwargs):
@@ -990,10 +998,13 @@ def DefaultDeltaBaseCacheLimit():
else:
return '512m'
def DefaultIndexPackConfig():
def DefaultIndexPackConfig(url=''):
"""Return reasonable default values for configuring git-index-pack.
Experiments suggest that higher values for pack.threads don't improve
performance."""
return ['-c', 'pack.threads=5', '-c',
'core.deltaBaseCacheLimit=%s' % DefaultDeltaBaseCacheLimit()]
cache_limit = DefaultDeltaBaseCacheLimit()
result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
if url in THREADED_INDEX_PACK_BLACKLIST:
result.extend(['-c', 'pack.threads=1'])
return result