From 48b2d10d8f7565173ca53bed0d0be15323512de4 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Mon, 11 Jan 2021 12:18:47 -0800 Subject: [PATCH] manifest_xml: - Added doc and testing of unknown tags/elements. Added this test to verify that older versions of repo can handle " Change-Id: I858d56f38cefcfcd14474efdd631a5a940c3ce47 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/293482 Reviewed-by: Mike Frysinger --- docs/manifest-format.md | 6 ++++++ tests/test_manifest_xml.py | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/docs/manifest-format.md b/docs/manifest-format.md index 8e5e2874..6156333a 100644 --- a/docs/manifest-format.md +++ b/docs/manifest-format.md @@ -109,6 +109,12 @@ following DTD: ]> ``` +For compatibility purposes across repo releases, all unknown elements are +silently ignored. However, repo reserves all possible names for itself for +future use. If you want to use custom elements, the `x-*` namespace is +reserved for that purpose, and repo guarantees to never allocate any +corresponding names. + A description of the elements and their attributes follows. diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index e4adf3c9..e2c83af9 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -280,6 +280,27 @@ class XmlManifestTests(unittest.TestCase): '' + '') + def test_unknown_tags(self): + """Check superproject settings.""" + manifest = self.getXmlManifest(""" + + + + + + X tags are always ignored + +""") + self.assertEqual(manifest.superproject['name'], 'superproject') + self.assertEqual(manifest.superproject['remote'].name, 'test-remote') + self.assertEqual( + manifest.ToXml().toxml(), + '' + + '' + + '' + + '' + + '') + def test_project_group(self): """Check project group settings.""" manifest = self.getXmlManifest("""