mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
manifest_xml: - Added doc and testing of unknown tags/elements.
Added this test to verify that older versions of repo can handle "<superproject" element. Tested by adding "<iankaz" unknown element. Tested the code with the following commands. $ ./run_tests tests/test_manifest_xml.py $ ./run_tests -v Bug: https://crbug.com/gerrit/13709 Tested-by: Raman Tenneti <rtenneti@google.com> Change-Id: I858d56f38cefcfcd14474efdd631a5a940c3ce47 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/293482 Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
0588f3dc52
commit
48b2d10d8f
@ -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.
|
A description of the elements and their attributes follows.
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,6 +280,27 @@ class XmlManifestTests(unittest.TestCase):
|
|||||||
'<superproject name="superproject"/>' +
|
'<superproject name="superproject"/>' +
|
||||||
'</manifest>')
|
'</manifest>')
|
||||||
|
|
||||||
|
def test_unknown_tags(self):
|
||||||
|
"""Check superproject settings."""
|
||||||
|
manifest = self.getXmlManifest("""
|
||||||
|
<manifest>
|
||||||
|
<remote name="test-remote" fetch="http://localhost" />
|
||||||
|
<default remote="test-remote" revision="refs/heads/main" />
|
||||||
|
<superproject name="superproject"/>
|
||||||
|
<iankaz value="unknown (possible) future tags are ignored"/>
|
||||||
|
<x-custom-tag>X tags are always ignored</x-custom-tag>
|
||||||
|
</manifest>
|
||||||
|
""")
|
||||||
|
self.assertEqual(manifest.superproject['name'], 'superproject')
|
||||||
|
self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
|
||||||
|
self.assertEqual(
|
||||||
|
manifest.ToXml().toxml(),
|
||||||
|
'<?xml version="1.0" ?><manifest>' +
|
||||||
|
'<remote name="test-remote" fetch="http://localhost"/>' +
|
||||||
|
'<default remote="test-remote" revision="refs/heads/main"/>' +
|
||||||
|
'<superproject name="superproject"/>' +
|
||||||
|
'</manifest>')
|
||||||
|
|
||||||
def test_project_group(self):
|
def test_project_group(self):
|
||||||
"""Check project group settings."""
|
"""Check project group settings."""
|
||||||
manifest = self.getXmlManifest("""
|
manifest = self.getXmlManifest("""
|
||||||
|
Loading…
Reference in New Issue
Block a user