From be71c2f80fa115e8256211fd0e3116d93cfae93e Mon Sep 17 00:00:00 2001 From: Fredrik de Groot Date: Wed, 31 May 2023 16:56:34 +0200 Subject: manifest: enable remove-project using path A something.xml that gets included by two different files, that both remove and add same shared project to two different locations, would not work prior to this change. Reason is that remove killed all name keys, even though reuse of same repo in different locations is allowed. Solve by adding optional attrib path to and tweak remove-project. Behaves as before without path, and deletes more selectively when remove path is supplied. As secondary feature, a project can now also be removed by only using path, assuming a matching project name can be found. Change-Id: I502d9f949f5d858ddc1503846b170473f76dc8e2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/375694 Tested-by: Fredrik de Groot Reviewed-by: Mike Frysinger --- tests/test_manifest_xml.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/test_manifest_xml.py') diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index ef511055..1015e114 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -996,6 +996,44 @@ class RemoveProjectElementTests(ManifestParseTestCase): ) self.assertEqual(manifest.projects, []) + def test_remove_using_path_attrib(self): + manifest = self.getXmlManifest( + """ + + + + + + + + + + + + + + + + + + +""" + ) + found_proj1_path1 = False + found_proj2 = False + for proj in manifest.projects: + if proj.name == "project1": + found_proj1_path1 = True + self.assertEqual(proj.relpath, "tests/path1") + if proj.name == "project2": + found_proj2 = True + self.assertNotEqual(proj.name, "project3") + self.assertNotEqual(proj.name, "project4") + self.assertNotEqual(proj.name, "project5") + self.assertNotEqual(proj.name, "project6") + self.assertTrue(found_proj1_path1) + self.assertTrue(found_proj2) + class ExtendProjectElementTests(ManifestParseTestCase): """Tests for .""" -- cgit v1.2.3-54-g00ecf