manifest_xml: Add Load and Unload methods

- do not call the internal method from subcmds/sync.py.
- use the correct default groups for submanifests.
- only sync the superproject when we are told to.

Change-Id: I81e4025058f1ee564732b9e17aecc522f6b5f626
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334639
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
This commit is contained in:
LaMont Jones
2022-04-07 16:49:06 +00:00
parent 55ee304304
commit a2ff20dd20
3 changed files with 31 additions and 19 deletions

View File

@@ -3491,6 +3491,8 @@ class ManifestProject(MetaProject):
"""
assert _kwargs_only == (), 'Sync only accepts keyword arguments.'
groups = groups or 'default'
platform = platform or 'auto'
git_event_log = git_event_log or EventLog()
if outer_manifest and self.manifest.is_submanifest:
# In a multi-manifest checkout, use the outer manifest unless we are told
@@ -3783,19 +3785,18 @@ class ManifestProject(MetaProject):
)
# Lastly, clone the superproject(s).
if outer_manifest and not self.manifest.is_submanifest:
for m in self.manifest.all_manifests:
sync_result = Superproject(
m, m.repodir, git_event_log, quiet=not verbose).Sync()
if not sync_result.success:
print(f'warning: git update of superproject for {m.path_prefix} failed, '
'repo sync will not '
'use superproject to fetch source; while this error is not fatal, '
'and you can continue to run repo sync, please run repo init with '
'the --no-use-superproject option to stop seeing this warning',
file=sys.stderr)
if sync_result.fatal and use_superproject is not None:
return False
if self.manifest.manifestProject.use_superproject:
sync_result = Superproject(
self.manifest, self.manifest.repodir, git_event_log, quiet=not verbose).Sync()
if not sync_result.success:
print('warning: git update of superproject for '
f'{self.manifest.path_prefix} failed, repo sync will not use '
'superproject to fetch source; while this error is not fatal, '
'and you can continue to run repo sync, please run repo init '
'with the --no-use-superproject option to stop seeing this '
'warning', file=sys.stderr)
if sync_result.fatal and use_superproject is not None:
return False
return True