ManifestProject: add manifest_platform

And fix most of the other attributes to return the value instead of
None.

Change-Id: Iddcbbeb56238ee082bb1cae30adbd27a2f551f3d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/335134
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Reviewed-by: Xin Li <delphij@google.com>
This commit is contained in:
LaMont Jones 2022-04-14 15:10:43 +00:00
parent d8de29c447
commit 4ada043dc0

View File

@ -3371,67 +3371,72 @@ class ManifestProject(MetaProject):
@property @property
def reference(self): def reference(self):
"""The --reference for this manifest.""" """The --reference for this manifest."""
self.config.GetString('repo.reference') return self.config.GetString('repo.reference')
@property @property
def dissociate(self): def dissociate(self):
"""Whether to dissociate.""" """Whether to dissociate."""
self.config.GetBoolean('repo.dissociate') return self.config.GetBoolean('repo.dissociate')
@property @property
def archive(self): def archive(self):
"""Whether we use archive.""" """Whether we use archive."""
self.config.GetBoolean('repo.archive') return self.config.GetBoolean('repo.archive')
@property @property
def mirror(self): def mirror(self):
"""Whether we use mirror.""" """Whether we use mirror."""
self.config.GetBoolean('repo.mirror') return self.config.GetBoolean('repo.mirror')
@property @property
def use_worktree(self): def use_worktree(self):
"""Whether we use worktree.""" """Whether we use worktree."""
self.config.GetBoolean('repo.worktree') return self.config.GetBoolean('repo.worktree')
@property @property
def clone_bundle(self): def clone_bundle(self):
"""Whether we use clone_bundle.""" """Whether we use clone_bundle."""
self.config.GetBoolean('repo.clonebundle') return self.config.GetBoolean('repo.clonebundle')
@property @property
def submodules(self): def submodules(self):
"""Whether we use submodules.""" """Whether we use submodules."""
self.config.GetBoolean('repo.submodules') return self.config.GetBoolean('repo.submodules')
@property @property
def git_lfs(self): def git_lfs(self):
"""Whether we use git_lfs.""" """Whether we use git_lfs."""
self.config.GetBoolean('repo.git-lfs') return self.config.GetBoolean('repo.git-lfs')
@property @property
def use_superproject(self): def use_superproject(self):
"""Whether we use superproject.""" """Whether we use superproject."""
self.config.GetBoolean('repo.superproject') return self.config.GetBoolean('repo.superproject')
@property @property
def partial_clone(self): def partial_clone(self):
"""Whether this is a partial clone.""" """Whether this is a partial clone."""
self.config.GetBoolean('repo.partialclone') return self.config.GetBoolean('repo.partialclone')
@property @property
def depth(self): def depth(self):
"""Partial clone depth.""" """Partial clone depth."""
self.config.GetString('repo.depth') return self.config.GetString('repo.depth')
@property @property
def clone_filter(self): def clone_filter(self):
"""The clone filter.""" """The clone filter."""
self.config.GetString('repo.clonefilter') return self.config.GetString('repo.clonefilter')
@property @property
def partial_clone_exclude(self): def partial_clone_exclude(self):
"""Partial clone exclude string""" """Partial clone exclude string"""
self.config.GetBoolean('repo.partialcloneexclude') return self.config.GetBoolean('repo.partialcloneexclude')
@property
def manifest_platform(self):
"""The --platform argument from `repo init`."""
return self.config.GetString('manifest.platform')
@property @property
def _platform_name(self): def _platform_name(self):
@ -3479,7 +3484,7 @@ class ManifestProject(MetaProject):
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. 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
manifest. manifest.
@ -3620,6 +3625,7 @@ class ManifestProject(MetaProject):
elif platform != 'none': elif platform != 'none':
print('fatal: invalid platform flag', file=sys.stderr) print('fatal: invalid platform flag', file=sys.stderr)
return False return False
self.config.SetString('manifest.platform', platform)
groups = [x for x in groups if x] groups = [x for x in groups if x]
groupstr = ','.join(groups) groupstr = ','.join(groups)