summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-02-14 17:48:31 +0000
committerLaMont Jones <lamontjones@google.com>2022-02-15 22:15:42 +0000
commit87cce68b28c34fa86895baa8d7f48307382e6c75 (patch)
treec3c31ad8c5d907c9aecc92ee349b2e3ff4c46ac0
parentadaa1d8734b9759c6e5fcb89398f34659aec49da (diff)
downloadgit-repo-87cce68b28c34fa86895baa8d7f48307382e6c75.tar.gz
Move local-manifest check to manifest_xml.py
This removes the need for git_superproject to include manifest_xml, and puts the logic for local_manifest detection in one place. Change-Id: I4d33ded0542ceea4606a1ea24304f678de20c59e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/330499 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com>
-rw-r--r--git_superproject.py3
-rw-r--r--manifest_xml.py6
2 files changed, 7 insertions, 2 deletions
diff --git a/git_superproject.py b/git_superproject.py
index 4ca84a58..237e57e1 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -32,7 +32,6 @@ from typing import NamedTuple
32from git_command import git_require, GitCommand 32from git_command import git_require, GitCommand
33from git_config import RepoConfig 33from git_config import RepoConfig
34from git_refs import R_HEADS 34from git_refs import R_HEADS
35from manifest_xml import LOCAL_MANIFEST_GROUP_PREFIX
36 35
37_SUPERPROJECT_GIT_NAME = 'superproject.git' 36_SUPERPROJECT_GIT_NAME = 'superproject.git'
38_SUPERPROJECT_MANIFEST_NAME = 'superproject_override.xml' 37_SUPERPROJECT_MANIFEST_NAME = 'superproject_override.xml'
@@ -311,7 +310,7 @@ class Superproject(object):
311 if project.revisionId: 310 if project.revisionId:
312 return True 311 return True
313 # Skip the project if it comes from the local manifest. 312 # Skip the project if it comes from the local manifest.
314 return any(s.startswith(LOCAL_MANIFEST_GROUP_PREFIX) for s in project.groups) 313 return project.manifest.IsFromLocalManifest(project)
315 314
316 def UpdateProjectsRevisionId(self, projects): 315 def UpdateProjectsRevisionId(self, projects):
317 """Update revisionId of every project in projects with the commit id. 316 """Update revisionId of every project in projects with the commit id.
diff --git a/manifest_xml.py b/manifest_xml.py
index daf85d30..7c5906da 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -650,6 +650,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
650 def HasLocalManifests(self): 650 def HasLocalManifests(self):
651 return self._load_local_manifests and self.local_manifests 651 return self._load_local_manifests and self.local_manifests
652 652
653 def IsFromLocalManifest(self, project):
654 """Is the project from a local manifest?
655 """
656 return any(x.startswith(LOCAL_MANIFEST_GROUP_PREFIX)
657 for x in project.groups)
658
653 @property 659 @property
654 def IsMirror(self): 660 def IsMirror(self):
655 return self.manifestProject.config.GetBoolean('repo.mirror') 661 return self.manifestProject.config.GetBoolean('repo.mirror')