Merge commits up to v2.13.3
* tag 'v2.13.3':
superproject: Display status messages during repo init/sync.
tests: fix duplicate method from copy & paste error
Change-Id: I2deb32c22d4dc11788d5e4b486c01b7f0ca65dbd
diff --git a/git_superproject.py b/git_superproject.py
index a09edc1..651da48 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -41,7 +41,8 @@
lookup of commit ids for all projects. It contains _project_commit_ids which
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.
Args:
@@ -49,9 +50,11 @@
repodir: Path to the .repo/ dir for holding all internal checkout state.
It must be in the top directory of the repo client checkout.
superproject_dir: Relative path under |repodir| to checkout superproject.
+ quiet: If True then only print the progress messages.
"""
self._project_commit_ids = None
self._manifest = manifest
+ self._quiet = quiet
self._branch = self._GetBranch()
self._repodir = os.path.abspath(repodir)
self._superproject_dir = superproject_dir
@@ -89,6 +92,9 @@
"""
if not os.path.exists(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]
p = GitCommand(None,
cmd,
@@ -183,6 +189,8 @@
return False
if not self._Fetch(url):
return False
+ if not self._quiet:
+ print('%s: Initial setup for superproject completed.' % self._work_git)
return True
def _GetAllProjectsCommitIds(self):
diff --git a/subcmds/init.py b/subcmds/init.py
index fc44604..c2376b6 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -185,10 +185,15 @@
return {'REPO_MANIFEST_URL': 'manifest_url',
'REPO_MIRROR_LOCATION': 'reference'}
- def _CloneSuperproject(self):
- """Clone the superproject based on the superproject's url and branch."""
+ def _CloneSuperproject(self, opt):
+ """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,
- self.repodir)
+ self.repodir,
+ quiet=opt.quiet)
if not superproject.Sync():
print('error: git update of superproject failed', file=sys.stderr)
sys.exit(1)
@@ -553,7 +558,7 @@
self._LinkManifest(opt.manifest_name)
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 opt.config_name or self._ShouldConfigureUser(opt):
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 296c924..5d2868a 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -297,7 +297,8 @@
Returns path to the overriding manifest file.
"""
superproject = git_superproject.Superproject(self.manifest,
- self.repodir)
+ self.repodir,
+ quiet=opt.quiet)
all_projects = self.GetProjects(args,
missing_ok=True,
submodules_ok=opt.fetch_submodules)
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py
index 6400faf..e9a1f64 100644
--- a/tests/test_wrapper.py
+++ b/tests/test_wrapper.py
@@ -305,8 +305,8 @@
reqs = self.wrapper.Requirements({'python': {'hard': sys.version_info}})
reqs.assert_all()
- def test_assert_all_old_repo(self):
- """Check assert_all rejects old repo."""
+ def test_assert_all_old_python(self):
+ """Check assert_all rejects old python."""
reqs = self.wrapper.Requirements({'python': {'hard': [99999, 0]}})
with self.assertRaises(SystemExit):
reqs.assert_all()