summaryrefslogtreecommitdiffstats
path: root/tests/test_manifest_xml.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-02-06 09:44:15 -0800
committerRaman Tenneti <rtenneti@google.com>2021-02-07 17:13:35 +0000
commitb5c5a5e0688743b21c032287ae2b4357ec66f11d (patch)
treed090c18558bbdbc0cecef04e207a144b920a6fb4 /tests/test_manifest_xml.py
parent0286e31ec7fd76237b597846b394a681ba78bb0b (diff)
downloadgit-repo-b5c5a5e0688743b21c032287ae2b4357ec66f11d.tar.gz
manifest: set revisionId as revision attribute it it is not being set in ToXml.
As we were testing superproject setting revisionId attribute to SHA and reloading the manifest, we found out revisionId attribute is not being saved. Made the change to save the revisionId if it is not being saved. Tested the code with the following commands. $ ./run_tests -v Bug: https://crbug.com/gerrit/13709 Bug: https://crbug.com/gerrit/13707 Tested-by: Raman Tenneti <rtenneti@google.com> Change-Id: I95fdf655b19648ad3e9aba10b9bed8bb9439deb6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/296182 Reviewed-by: Ian Kasprzak <iankaz@google.com>
Diffstat (limited to 'tests/test_manifest_xml.py')
-rw-r--r--tests/test_manifest_xml.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index 370eb4f5..5fd242fc 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -327,6 +327,26 @@ class XmlManifestTests(unittest.TestCase):
327 result['extras'], 327 result['extras'],
328 ['g1', 'g2', 'g1', 'name:extras', 'all', 'path:path']) 328 ['g1', 'g2', 'g1', 'name:extras', 'all', 'path:path'])
329 329
330 def test_project_set_revision_id(self):
331 """Check setting of project's revisionId."""
332 manifest = self.getXmlManifest("""
333<manifest>
334 <remote name="default-remote" fetch="http://localhost" />
335 <default remote="default-remote" revision="refs/heads/main" />
336 <project name="test-name"/>
337</manifest>
338""")
339 self.assertEqual(len(manifest.projects), 1)
340 project = manifest.projects[0]
341 project.SetRevisionId('ABCDEF')
342 self.assertEqual(
343 manifest.ToXml().toxml(),
344 '<?xml version="1.0" ?><manifest>' +
345 '<remote name="default-remote" fetch="http://localhost"/>' +
346 '<default remote="default-remote" revision="refs/heads/main"/>' +
347 '<project name="test-name" revision="ABCDEF"/>' +
348 '</manifest>')
349
330 def test_include_levels(self): 350 def test_include_levels(self):
331 root_m = os.path.join(self.manifest_dir, 'root.xml') 351 root_m = os.path.join(self.manifest_dir, 'root.xml')
332 with open(root_m, 'w') as fp: 352 with open(root_m, 'w') as fp: