sync: With --mirror option, don't display no-use-superproject... message.

+ Display 'Defaulting to no-use-superproject because there is no working tree.'
  message if --use-superproject option is used and we are not using
  superproject because manifest is either a mirror or is an archive.

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 init -u https://android.googlesource.com/mirror/manifest --mirror

$ repo_dev sync
Receiving objects: 100% (3/3), done.eiving objects:  33% (1/3)

$ repo_dev sync --use-superproject
Defaulting to no-use-superproject because there is no working tree.
Fetching:  0% (0/2158) warming up

Bug: https://crbug.com/gerrit/15368
Change-Id: I16b87ee9623315dbc3100b612b1decdaab7ac1dc
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/325797
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Raman Tenneti <rtenneti@google.com>
This commit is contained in:
Raman Tenneti 2021-12-06 18:12:59 -08:00
parent 2a089cfee4
commit cf0ba48649

View File

@ -986,10 +986,11 @@ later is required to fix a server side protocol bug.
load_local_manifests = not self.manifest.HasLocalManifests load_local_manifests = not self.manifest.HasLocalManifests
use_superproject = git_superproject.UseSuperproject(opt, self.manifest) use_superproject = git_superproject.UseSuperproject(opt, self.manifest)
if self.manifest.IsMirror or self.manifest.IsArchive: if use_superproject and (self.manifest.IsMirror or self.manifest.IsArchive):
# Don't use superproject, because we have no working tree. # Don't use superproject, because we have no working tree.
use_superproject = False use_superproject = False
print('Defaulting to no-use-superproject because there is no working tree.') if opt.use_superproject is not None:
print('Defaulting to no-use-superproject because there is no working tree.')
superproject_logging_data = { superproject_logging_data = {
'superproject': use_superproject, 'superproject': use_superproject,
'haslocalmanifests': bool(self.manifest.HasLocalManifests), 'haslocalmanifests': bool(self.manifest.HasLocalManifests),