From 2cc3ab7663ae867c6103bcf5c90a8e9e7999c15e Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Wed, 13 Apr 2022 15:58:58 +0000 Subject: [PATCH] git_superproject: only print beta notice once. This eliminates duplicate notices during multi-manifest syncs. Change-Id: Idcb038ddeb363368637c58c11346ebf8fd2b27ac Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334939 Reviewed-by: Mike Frysinger Tested-by: LaMont Jones --- git_superproject.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/git_superproject.py b/git_superproject.py index 9f585e5d..1293f352 100644 --- a/git_superproject.py +++ b/git_superproject.py @@ -238,8 +238,8 @@ class Superproject(object): f'{self._manifest.manifestFile}') return SyncResult(False, False) - print('NOTICE: --use-superproject is in beta; report any issues to the ' - 'address described in `repo version`', file=sys.stderr) + _PrintBetaNotice() + should_exit = True if not self._remote_url: self._LogWarning(f'superproject URL is not defined in manifest: ' @@ -364,6 +364,13 @@ class Superproject(object): return UpdateProjectsResult(manifest_path, False) +@functools.lru_cache(maxsize=10) +def _PrintBetaNotice(): + """Print the notice of beta status.""" + print('NOTICE: --use-superproject is in beta; report any issues to the ' + 'address described in `repo version`', file=sys.stderr) + + @functools.lru_cache(maxsize=None) def _UseSuperprojectFromConfiguration(): """Returns the user choice of whether to use superproject."""