mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
superproject: Display status messages during repo init/sync.
Superproject objects accept the optional argument “quiet”. The following progress messages are displayed if quiet is false. Displayed the following message whenever we find we have to make a new folder (aka new remote), because if you started with repo init android and later do googleplex-android that is when it will be slow. "<location>: Performing initial setup for superproject; this might take several minutes.". After fetch completion, added the following notification: "<location>: Initial setup for superproject completed." Tested the code with the following commands. $ ./run_tests -v Tested the sync code by using repo_dev alias and pointing to this CL. $ repo_dev init -u persistent-https://googleplex-android.git.corp.google.com/platform/manifest -b rvc-dev --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject Bug: [google internal] b/181178282 Bug: https://crbug.com/gerrit/13707 Change-Id: Ia7fb85c6fb934faaa90c48fc0c55e7f41055f48a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299122 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
This commit is contained in:
parent
934cb0a849
commit
ef99ec07b4
@ -41,7 +41,8 @@ class Superproject(object):
|
|||||||
lookup of commit ids for all projects. It contains _project_commit_ids which
|
lookup of commit ids for all projects. It contains _project_commit_ids which
|
||||||
is a dictionary with project/commit id entries.
|
is a dictionary with project/commit id entries.
|
||||||
"""
|
"""
|
||||||
def __init__(self, manifest, repodir, superproject_dir='exp-superproject'):
|
def __init__(self, manifest, repodir, superproject_dir='exp-superproject',
|
||||||
|
quiet=False):
|
||||||
"""Initializes superproject.
|
"""Initializes superproject.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -49,9 +50,11 @@ class Superproject(object):
|
|||||||
repodir: Path to the .repo/ dir for holding all internal checkout state.
|
repodir: Path to the .repo/ dir for holding all internal checkout state.
|
||||||
It must be in the top directory of the repo client checkout.
|
It must be in the top directory of the repo client checkout.
|
||||||
superproject_dir: Relative path under |repodir| to checkout superproject.
|
superproject_dir: Relative path under |repodir| to checkout superproject.
|
||||||
|
quiet: If True then only print the progress messages.
|
||||||
"""
|
"""
|
||||||
self._project_commit_ids = None
|
self._project_commit_ids = None
|
||||||
self._manifest = manifest
|
self._manifest = manifest
|
||||||
|
self._quiet = quiet
|
||||||
self._branch = self._GetBranch()
|
self._branch = self._GetBranch()
|
||||||
self._repodir = os.path.abspath(repodir)
|
self._repodir = os.path.abspath(repodir)
|
||||||
self._superproject_dir = superproject_dir
|
self._superproject_dir = superproject_dir
|
||||||
@ -89,6 +92,9 @@ class Superproject(object):
|
|||||||
"""
|
"""
|
||||||
if not os.path.exists(self._superproject_path):
|
if not os.path.exists(self._superproject_path):
|
||||||
os.mkdir(self._superproject_path)
|
os.mkdir(self._superproject_path)
|
||||||
|
if not self._quiet and not os.path.exists(self._work_git):
|
||||||
|
print('%s: Performing initial setup for superproject; this might take '
|
||||||
|
'several minutes.' % self._work_git)
|
||||||
cmd = ['init', '--bare', self._work_git_name]
|
cmd = ['init', '--bare', self._work_git_name]
|
||||||
p = GitCommand(None,
|
p = GitCommand(None,
|
||||||
cmd,
|
cmd,
|
||||||
@ -183,6 +189,8 @@ class Superproject(object):
|
|||||||
return False
|
return False
|
||||||
if not self._Fetch(url):
|
if not self._Fetch(url):
|
||||||
return False
|
return False
|
||||||
|
if not self._quiet:
|
||||||
|
print('%s: Initial setup for superproject completed.' % self._work_git)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _GetAllProjectsCommitIds(self):
|
def _GetAllProjectsCommitIds(self):
|
||||||
|
@ -185,10 +185,15 @@ to update the working directory files.
|
|||||||
return {'REPO_MANIFEST_URL': 'manifest_url',
|
return {'REPO_MANIFEST_URL': 'manifest_url',
|
||||||
'REPO_MIRROR_LOCATION': 'reference'}
|
'REPO_MIRROR_LOCATION': 'reference'}
|
||||||
|
|
||||||
def _CloneSuperproject(self):
|
def _CloneSuperproject(self, opt):
|
||||||
"""Clone the superproject based on the superproject's url and branch."""
|
"""Clone the superproject based on the superproject's url and branch.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
opt: Program options returned from optparse. See _Options().
|
||||||
|
"""
|
||||||
superproject = git_superproject.Superproject(self.manifest,
|
superproject = git_superproject.Superproject(self.manifest,
|
||||||
self.repodir)
|
self.repodir,
|
||||||
|
quiet=opt.quiet)
|
||||||
if not superproject.Sync():
|
if not superproject.Sync():
|
||||||
print('error: git update of superproject failed', file=sys.stderr)
|
print('error: git update of superproject failed', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -553,7 +558,7 @@ to update the working directory files.
|
|||||||
self._LinkManifest(opt.manifest_name)
|
self._LinkManifest(opt.manifest_name)
|
||||||
|
|
||||||
if self.manifest.manifestProject.config.GetBoolean('repo.superproject'):
|
if self.manifest.manifestProject.config.GetBoolean('repo.superproject'):
|
||||||
self._CloneSuperproject()
|
self._CloneSuperproject(opt)
|
||||||
|
|
||||||
if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
|
if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
|
||||||
if opt.config_name or self._ShouldConfigureUser(opt):
|
if opt.config_name or self._ShouldConfigureUser(opt):
|
||||||
|
@ -292,7 +292,8 @@ later is required to fix a server side protocol bug.
|
|||||||
Returns path to the overriding manifest file.
|
Returns path to the overriding manifest file.
|
||||||
"""
|
"""
|
||||||
superproject = git_superproject.Superproject(self.manifest,
|
superproject = git_superproject.Superproject(self.manifest,
|
||||||
self.repodir)
|
self.repodir,
|
||||||
|
quiet=opt.quiet)
|
||||||
all_projects = self.GetProjects(args,
|
all_projects = self.GetProjects(args,
|
||||||
missing_ok=True,
|
missing_ok=True,
|
||||||
submodules_ok=opt.fetch_submodules)
|
submodules_ok=opt.fetch_submodules)
|
||||||
|
Loading…
Reference in New Issue
Block a user