From ef99ec07b4687cef0129057b81c0c1ebd21bb640 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Thu, 4 Mar 2021 10:29:40 -0800 Subject: superproject: Display status messages during repo init/sync. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. ": Performing initial setup for superproject; this might take several minutes.". After fetch completion, added the following notification: ": 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 Tested-by: Raman Tenneti --- git_superproject.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'git_superproject.py') diff --git a/git_superproject.py b/git_superproject.py index a09edc15..651da48a 100644 --- a/git_superproject.py +++ b/git_superproject.py @@ -41,7 +41,8 @@ class Superproject(object): 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 @@ class Superproject(object): 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 @@ class Superproject(object): """ 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 @@ class Superproject(object): 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): -- cgit v1.2.3-54-g00ecf