From b55769a5c9422e0aac532e901a4d7b5af834b34d Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Fri, 13 Aug 2021 11:47:24 -0700 Subject: superproject: print messages if the manifest has superproject tag. 1) If the manifest has superproject tag (git_master, etc), then display error/warning messages (as it is doing today) 2) If the manifest doesn't have superproject tag (nest, chromeos manifests), then don't display any error/warning messages about superrproject (behave as though user has specified --no-use-superproject). 3) Print error/warning messages if --use-superproject passed as argument to repo sync. 4) No change in behavior for the repo init command. git_superproject.py: + Fixed typo in _WriteManifestFile method name + Superproject accepts print_message as an argument and it defaults to True. All messages that are printed to stderr are controlled by this flag. If it is True, then messages get printed. + Added PrintMessages function which return true if either --use-superproject is specified on the command line or if the manifest has a superproject tag. sync.py: + Displays the warning message if PrintMessgages are enabled and passes that as argument to superproject object. + Added 'hassuperprojecttag' trace2 log entry for analysis. We can find users/branches that are using superproject, but the manifest is missing the superproject tag. Tested: $ ./run_tests + Verified printing of messages with and without superproject tag, with with --use-superproject option. + aosp-master $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest $ repo_dev sync + A manifest without superproject tag. $ repo_dev init -m $(pwd)/manifest_7482982.xml $ repo_dev sync -n -c -j32 -m $(pwd)/manifest_7482982.xml Bug: [google internal] b/196411099 Change-Id: I92166dcad15a4129fab82edcf869e7c8db3efd4b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/314982 Reviewed-by: Xin Li Tested-by: Raman Tenneti --- subcmds/sync.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index ed656b8c..2a0de0a9 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -298,10 +298,12 @@ later is required to fix a server side protocol bug. Returns: Returns path to the overriding manifest file instead of None. """ + print_messages = git_superproject.PrintMessages(opt, self.manifest) superproject = git_superproject.Superproject(self.manifest, self.repodir, self.git_event_log, - quiet=opt.quiet) + quiet=opt.quiet, + print_messages=print_messages) if opt.local_only: manifest_path = superproject.manifest_path if manifest_path: @@ -317,10 +319,11 @@ later is required to fix a server side protocol bug. if manifest_path: self._ReloadManifest(manifest_path, load_local_manifests) else: - print('warning: Update of revisionId from superproject has failed, ' - 'repo sync will not use superproject to fetch the source. ', - 'Please resync with the --no-use-superproject option to avoid this repo warning.', - file=sys.stderr) + if print_messages: + print('warning: Update of revisionId from superproject has failed, ' + 'repo sync will not use superproject to fetch the source. ', + 'Please resync with the --no-use-superproject option to avoid this repo warning.', + file=sys.stderr) if update_result.fatal and opt.use_superproject is not None: sys.exit(1) return manifest_path @@ -970,6 +973,7 @@ later is required to fix a server side protocol bug. superproject_logging_data = { 'superproject': use_superproject, 'haslocalmanifests': bool(self.manifest.HasLocalManifests), + 'hassuperprojecttag': bool(self.manifest.superproject), } if use_superproject: manifest_name = self._UpdateProjectsRevisionId( -- cgit v1.2.3-54-g00ecf