summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py49
1 files changed, 36 insertions, 13 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 555bf736..73be1b6e 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -1535,22 +1535,45 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
1535 self._contactinfo = ContactInfo(bugurl) 1535 self._contactinfo = ContactInfo(bugurl)
1536 1536
1537 if node.nodeName == "remove-project": 1537 if node.nodeName == "remove-project":
1538 name = self._reqatt(node, "name") 1538 name = node.getAttribute("name")
1539 path = node.getAttribute("path")
1539 1540
1540 if name in self._projects: 1541 # Name or path needed.
1541 for p in self._projects[name]: 1542 if not name and not path:
1542 del self._paths[p.relpath] 1543 raise ManifestParseError(
1543 del self._projects[name] 1544 "remove-project must have name and/or path"
1544 1545 )
1545 # If the manifest removes the hooks project, treat it as if 1546
1546 # it deleted 1547 removed_project = ""
1547 # the repo-hooks element too. 1548
1548 if repo_hooks_project == name: 1549 # Find and remove projects based on name and/or path.
1549 repo_hooks_project = None 1550 for projname, projects in list(self._projects.items()):
1550 elif not XmlBool(node, "optional", False): 1551 for p in projects:
1552 if name == projname and not path:
1553 del self._paths[p.relpath]
1554 if not removed_project:
1555 del self._projects[name]
1556 removed_project = name
1557 elif path == p.relpath and (
1558 name == projname or not name
1559 ):
1560 self._projects[projname].remove(p)
1561 del self._paths[p.relpath]
1562 removed_project = p.name
1563
1564 # If the manifest removes the hooks project, treat it as if
1565 # it deleted the repo-hooks element too.
1566 if (
1567 removed_project
1568 and removed_project not in self._projects
1569 and repo_hooks_project == removed_project
1570 ):
1571 repo_hooks_project = None
1572
1573 if not removed_project and not XmlBool(node, "optional", False):
1551 raise ManifestParseError( 1574 raise ManifestParseError(
1552 "remove-project element specifies non-existent " 1575 "remove-project element specifies non-existent "
1553 "project: %s" % name 1576 "project: %s" % node.toxml()
1554 ) 1577 )
1555 1578
1556 # Store repo hooks project information. 1579 # Store repo hooks project information.