summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorMichael Kelly <mkelly@arista.com>2021-06-30 01:58:28 -0700
committerMichael Kelly <mkelly@arista.com>2021-07-08 16:48:21 +0000
commit06da9987f6be6ddc1637e8ae02646d6dfab09862 (patch)
treebe93f68a568f27341b61fa367a42dcdfe75df234 /manifest_xml.py
parent58929732123780497ba08ed9c2d24f4bc65971a1 (diff)
downloadgit-repo-06da9987f6be6ddc1637e8ae02646d6dfab09862.tar.gz
Gracefully ignore bad remove-project line
Sometimes, we don't care if the remove project is referring to a non-existing project and we can just ignore it. This change allows us to ignore remove-project entries if the project that they refer to doesn't exist, making them effectively a no-op. Because this change breaks existing configuration, we allow this to be configuration controlled using the `optional` attribute in the remove-project tag. Change-Id: I6313a02983e81344eadcb4e47d7d6b037ee7420e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310964 Tested-by: Michael Kelly <mkelly@arista.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index ab4be2f5..be74bf49 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -918,19 +918,19 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
918 if node.nodeName == 'remove-project': 918 if node.nodeName == 'remove-project':
919 name = self._reqatt(node, 'name') 919 name = self._reqatt(node, 'name')
920 920
921 if name not in self._projects: 921 if name in self._projects:
922 for p in self._projects[name]:
923 del self._paths[p.relpath]
924 del self._projects[name]
925
926 # If the manifest removes the hooks project, treat it as if it deleted
927 # the repo-hooks element too.
928 if self._repo_hooks_project and (self._repo_hooks_project.name == name):
929 self._repo_hooks_project = None
930 elif not XmlBool(node, 'optional', False):
922 raise ManifestParseError('remove-project element specifies non-existent ' 931 raise ManifestParseError('remove-project element specifies non-existent '
923 'project: %s' % name) 932 'project: %s' % name)
924 933
925 for p in self._projects[name]:
926 del self._paths[p.relpath]
927 del self._projects[name]
928
929 # If the manifest removes the hooks project, treat it as if it deleted
930 # the repo-hooks element too.
931 if self._repo_hooks_project and (self._repo_hooks_project.name == name):
932 self._repo_hooks_project = None
933
934 def _AddMetaProjectMirror(self, m): 934 def _AddMetaProjectMirror(self, m):
935 name = None 935 name = None
936 m_url = m.GetRemote(m.remote.name).url 936 m_url = m.GetRemote(m.remote.name).url