mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
Fix sub manifest handling
Also fixes some typos Change-Id: Id2ba5834ba3a74ed3f29c36d2c0030737dc63e35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334579 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
409407a731
commit
55ee304304
@ -243,12 +243,13 @@ class _XmlSubmanifest:
|
|||||||
manifestFile = parent.SubmanifestInfoDir(
|
manifestFile = parent.SubmanifestInfoDir(
|
||||||
os.path.join(parent.path_prefix, self.relpath),
|
os.path.join(parent.path_prefix, self.relpath),
|
||||||
os.path.join('manifests', manifestName or 'default.xml'))
|
os.path.join('manifests', manifestName or 'default.xml'))
|
||||||
|
linkFile = parent.SubmanifestInfoDir(
|
||||||
|
os.path.join(parent.path_prefix, self.relpath), MANIFEST_FILE_NAME)
|
||||||
rc = self.repo_client = RepoClient(
|
rc = self.repo_client = RepoClient(
|
||||||
parent.repodir, manifestFile, parent_groups=','.join(groups) or '',
|
parent.repodir, linkFile, parent_groups=','.join(groups) or '',
|
||||||
submanifest_path=self.relpath, outer_client=outer_client)
|
submanifest_path=self.relpath, outer_client=outer_client)
|
||||||
|
|
||||||
self.present = os.path.exists(os.path.join(self.repo_client.subdir,
|
self.present = os.path.exists(manifestFile)
|
||||||
MANIFEST_FILE_NAME))
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if not isinstance(other, _XmlSubmanifest):
|
if not isinstance(other, _XmlSubmanifest):
|
||||||
@ -1051,7 +1052,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
|
|||||||
tree.present = present
|
tree.present = present
|
||||||
elif not os.path.exists(self.subdir):
|
elif not os.path.exists(self.subdir):
|
||||||
tree.present = False
|
tree.present = False
|
||||||
if tree.present:
|
if present and tree.present:
|
||||||
tree.repo_client._Load(initial_client=initial_client,
|
tree.repo_client._Load(initial_client=initial_client,
|
||||||
submanifest_depth=submanifest_depth + 1)
|
submanifest_depth=submanifest_depth + 1)
|
||||||
|
|
||||||
|
103
project.py
103
project.py
@ -32,10 +32,11 @@ from color import Coloring
|
|||||||
from git_command import GitCommand, git_require
|
from git_command import GitCommand, git_require
|
||||||
from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \
|
from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \
|
||||||
ID_RE
|
ID_RE
|
||||||
|
from git_trace2_event_log import EventLog
|
||||||
from error import GitError, UploadError, DownloadError
|
from error import GitError, UploadError, DownloadError
|
||||||
from error import ManifestInvalidRevisionError, ManifestInvalidPathError
|
from error import ManifestInvalidRevisionError, ManifestInvalidPathError
|
||||||
from error import NoManifestException, ManifestParseError
|
from error import NoManifestException, ManifestParseError
|
||||||
import git_superproject
|
from git_superproject import Superproject
|
||||||
import platform_utils
|
import platform_utils
|
||||||
import progress
|
import progress
|
||||||
from repo_trace import IsTrace, Trace
|
from repo_trace import IsTrace, Trace
|
||||||
@ -3361,7 +3362,7 @@ class ManifestProject(MetaProject):
|
|||||||
@property
|
@property
|
||||||
def standalone_manifest_url(self):
|
def standalone_manifest_url(self):
|
||||||
"""The URL of the standalone manifest, or None."""
|
"""The URL of the standalone manifest, or None."""
|
||||||
return self.config.getString('manifest.standalone')
|
return self.config.GetString('manifest.standalone')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def manifest_groups(self):
|
def manifest_groups(self):
|
||||||
@ -3444,8 +3445,8 @@ class ManifestProject(MetaProject):
|
|||||||
partial_clone=None, depth=None, clone_filter='blob:none',
|
partial_clone=None, depth=None, clone_filter='blob:none',
|
||||||
partial_clone_exclude=None, clone_bundle=None, git_lfs=None,
|
partial_clone_exclude=None, clone_bundle=None, git_lfs=None,
|
||||||
use_superproject=None, verbose=False, current_branch_only=False,
|
use_superproject=None, verbose=False, current_branch_only=False,
|
||||||
platform='', tags='', manifest_name='default.xml',
|
git_event_log=None, platform='', manifest_name='default.xml',
|
||||||
this_manifest_only=False, outer_manifest=True):
|
tags='', this_manifest_only=False, outer_manifest=True):
|
||||||
"""Sync the manifest and all submanifests.
|
"""Sync the manifest and all submanifests.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -3478,6 +3479,7 @@ class ManifestProject(MetaProject):
|
|||||||
branch from the server.
|
branch from the server.
|
||||||
platform: a string, restrict the checkout to projects with the specified
|
platform: a string, restrict the checkout to projects with the specified
|
||||||
platform group.
|
platform group.
|
||||||
|
git_event_log: an EventLog, for git tracing.
|
||||||
tags: a boolean, whether to fetch tags.,
|
tags: a boolean, whether to fetch tags.,
|
||||||
manifest_name: a string, the name of the manifest file to use.
|
manifest_name: a string, the name of the manifest file to use.
|
||||||
this_manifest_only: a boolean, whether to only operate on the current sub
|
this_manifest_only: a boolean, whether to only operate on the current sub
|
||||||
@ -3489,6 +3491,7 @@ class ManifestProject(MetaProject):
|
|||||||
"""
|
"""
|
||||||
assert _kwargs_only == (), 'Sync only accepts keyword arguments.'
|
assert _kwargs_only == (), 'Sync only accepts keyword arguments.'
|
||||||
|
|
||||||
|
git_event_log = git_event_log or EventLog()
|
||||||
if outer_manifest and self.manifest.is_submanifest:
|
if outer_manifest and self.manifest.is_submanifest:
|
||||||
# In a multi-manifest checkout, use the outer manifest unless we are told
|
# In a multi-manifest checkout, use the outer manifest unless we are told
|
||||||
# not to.
|
# not to.
|
||||||
@ -3514,6 +3517,7 @@ class ManifestProject(MetaProject):
|
|||||||
current_branch_only=current_branch_only,
|
current_branch_only=current_branch_only,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
depth=depth,
|
depth=depth,
|
||||||
|
git_event_log=git_event_log,
|
||||||
manifest_name=manifest_name,
|
manifest_name=manifest_name,
|
||||||
this_manifest_only=this_manifest_only,
|
this_manifest_only=this_manifest_only,
|
||||||
outer_manifest=False)
|
outer_manifest=False)
|
||||||
@ -3670,7 +3674,7 @@ class ManifestProject(MetaProject):
|
|||||||
self.config.SetBoolean('repo.partialclone', partial_clone)
|
self.config.SetBoolean('repo.partialclone', partial_clone)
|
||||||
if clone_filter:
|
if clone_filter:
|
||||||
self.config.SetString('repo.clonefilter', clone_filter)
|
self.config.SetString('repo.clonefilter', clone_filter)
|
||||||
elif self.partialclone:
|
elif self.partial_clone:
|
||||||
clone_filter = self.clone_filter
|
clone_filter = self.clone_filter
|
||||||
else:
|
else:
|
||||||
clone_filter = None
|
clone_filter = None
|
||||||
@ -3747,52 +3751,51 @@ class ManifestProject(MetaProject):
|
|||||||
print('fatal: %s' % str(e), file=sys.stderr)
|
print('fatal: %s' % str(e), file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Lastly, clone the superproject.
|
if not this_manifest_only:
|
||||||
superproject = git_superproject.Superproject(self.manifest,
|
for submanifest in self.manifest.submanifests.values():
|
||||||
self.repodir,
|
spec = submanifest.ToSubmanifestSpec(root=self.manifest.outer_client)
|
||||||
self.git_event_log,
|
submanifest.repo_client.manifestProject.Sync(
|
||||||
quiet=not verbose)
|
manifest_url=spec.manifestUrl,
|
||||||
sync_result = superproject.Sync()
|
manifest_branch=spec.revision,
|
||||||
if not sync_result.success:
|
standalone_manifest=standalone_manifest,
|
||||||
print('warning: git update of superproject failed, repo sync will not '
|
groups=self.manifest_groups,
|
||||||
'use superproject to fetch source; while this error is not fatal, '
|
platform=platform,
|
||||||
'and you can continue to run repo sync, please run repo init with '
|
mirror=mirror,
|
||||||
'the --no-use-superproject option to stop seeing this warning',
|
dissociate=dissociate,
|
||||||
file=sys.stderr)
|
reference=reference,
|
||||||
if sync_result.fatal and use_superproject is not None:
|
worktree=worktree,
|
||||||
return False
|
submodules=submodules,
|
||||||
|
archive=archive,
|
||||||
|
partial_clone=partial_clone,
|
||||||
|
clone_filter=clone_filter,
|
||||||
|
partial_clone_exclude=partial_clone_exclude,
|
||||||
|
clone_bundle=clone_bundle,
|
||||||
|
git_lfs=git_lfs,
|
||||||
|
use_superproject=use_superproject,
|
||||||
|
verbose=verbose,
|
||||||
|
current_branch_only=current_branch_only,
|
||||||
|
tags=tags,
|
||||||
|
depth=depth,
|
||||||
|
git_event_log=git_event_log,
|
||||||
|
manifest_name=spec.manifestName,
|
||||||
|
this_manifest_only=False,
|
||||||
|
outer_manifest=False,
|
||||||
|
)
|
||||||
|
|
||||||
if this_manifest_only:
|
# Lastly, clone the superproject(s).
|
||||||
return True
|
if outer_manifest and not self.manifest.is_submanifest:
|
||||||
|
for m in self.manifest.all_manifests:
|
||||||
for submanifest in self.manifest.submanifests.values():
|
sync_result = Superproject(
|
||||||
spec = submanifest.ToSubmanifestSpec(root=self.manifest.outer_client)
|
m, m.repodir, git_event_log, quiet=not verbose).Sync()
|
||||||
submanifest.repo_client.manifestProject.Sync(
|
if not sync_result.success:
|
||||||
manifest_url=spec.manifestUrl,
|
print(f'warning: git update of superproject for {m.path_prefix} failed, '
|
||||||
manifest_branch=spec.revision,
|
'repo sync will not '
|
||||||
standalone_manifest=standalone_manifest,
|
'use superproject to fetch source; while this error is not fatal, '
|
||||||
groups=self.manifest_groups,
|
'and you can continue to run repo sync, please run repo init with '
|
||||||
platform=platform,
|
'the --no-use-superproject option to stop seeing this warning',
|
||||||
mirror=mirror,
|
file=sys.stderr)
|
||||||
dissociate=dissociate,
|
if sync_result.fatal and use_superproject is not None:
|
||||||
reference=reference,
|
return False
|
||||||
worktree=worktree,
|
|
||||||
submodules=submodules,
|
|
||||||
archive=archive,
|
|
||||||
partial_clone=partial_clone,
|
|
||||||
clone_filter=clone_filter,
|
|
||||||
partial_clone_exclude=partial_clone_exclude,
|
|
||||||
clone_bundle=clone_bundle,
|
|
||||||
git_lfs=git_lfs,
|
|
||||||
use_superproject=use_superproject,
|
|
||||||
verbose=verbose,
|
|
||||||
current_branch_only=current_branch_only,
|
|
||||||
tags=tags,
|
|
||||||
depth=depth,
|
|
||||||
manifest_name=spec.manifestName,
|
|
||||||
this_manifest_only=False,
|
|
||||||
outer_manifest=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ to update the working directory files.
|
|||||||
current_branch_only=opt.current_branch_only,
|
current_branch_only=opt.current_branch_only,
|
||||||
tags=opt.tags,
|
tags=opt.tags,
|
||||||
depth=opt.depth,
|
depth=opt.depth,
|
||||||
|
git_event_log=self.git_event_log,
|
||||||
manifest_name=opt.manifest_name):
|
manifest_name=opt.manifest_name):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user