зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1645196: Tune git settings to improve performance r=rstewart
Also adds a warning if a user's git version is older than 2.24 Differential Revision: https://phabricator.services.mozilla.com/D82128
This commit is contained in:
Родитель
a22772e2a2
Коммит
99012368cc
|
@ -11,6 +11,7 @@ import platform
|
|||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
# NOTE: This script is intended to be run with a vanilla Python install. We
|
||||
# have to rely on the standard library instead of Python 2+3 helpers like
|
||||
|
@ -43,9 +44,7 @@ from mozboot.void import VoidBootstrapper
|
|||
from mozboot.windows import WindowsBootstrapper
|
||||
from mozboot.mozillabuild import MozillaBuildBootstrapper
|
||||
from mozboot.mozconfig import find_mozconfig
|
||||
from mozboot.util import (
|
||||
get_state_dir,
|
||||
)
|
||||
from mozboot.util import get_state_dir
|
||||
|
||||
# Use distro package to retrieve linux platform information
|
||||
import distro
|
||||
|
@ -233,6 +232,15 @@ Proceed at your own peril.
|
|||
'''
|
||||
|
||||
|
||||
# Version 2.24 changes the "core.commitGraph" setting to be "True" by default.
|
||||
MINIMUM_RECOMMENDED_GIT_VERSION = LooseVersion('2.24')
|
||||
OLD_GIT_WARNING = '''
|
||||
You are running an older version of git ("{old_version}").
|
||||
We recommend upgrading to at least version "{minimum_recommended_version}" to improve
|
||||
performance.
|
||||
'''.strip()
|
||||
|
||||
|
||||
def update_or_create_build_telemetry_config(path):
|
||||
"""Write a mach config file enabling build telemetry to `path`. If the file does not exist,
|
||||
create it. If it exists, add the new setting to the existing data.
|
||||
|
@ -802,6 +810,20 @@ def update_git_repo(git, url, dest):
|
|||
|
||||
def configure_git(git, cinnabar, root_state_dir, top_src_dir):
|
||||
"""Run the Git configuration steps."""
|
||||
from mozversioncontrol import GitRepository
|
||||
|
||||
repository = GitRepository(top_src_dir)
|
||||
git_version = LooseVersion(repository.tool_version)
|
||||
|
||||
if git_version < MINIMUM_RECOMMENDED_GIT_VERSION:
|
||||
print(OLD_GIT_WARNING.format(
|
||||
old_version=git_version,
|
||||
minimum_recommended_version=MINIMUM_RECOMMENDED_GIT_VERSION))
|
||||
|
||||
if git_version >= LooseVersion('2.17'):
|
||||
# "core.untrackedCache" has a bug before 2.17
|
||||
repository.set_config('core.untrackedCache', 'true')
|
||||
|
||||
cinnabar_dir = update_git_tools(git, root_state_dir, top_src_dir)
|
||||
|
||||
if not cinnabar:
|
||||
|
|
|
@ -585,6 +585,9 @@ class GitRepository(Repository):
|
|||
finally:
|
||||
self._run('reset', 'HEAD~')
|
||||
|
||||
def set_config(self, name, value):
|
||||
self._run('config', name, value)
|
||||
|
||||
|
||||
def get_repository_object(path, hg='hg', git='git'):
|
||||
'''Get a repository object for the repository at `path`.
|
||||
|
|
Загрузка…
Ссылка в новой задаче