diff --git a/manifest_xml.py b/manifest_xml.py index eb8a98cc..e32551c8 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -403,6 +403,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr if not revision or revision != p.revisionExpr: e.setAttribute('revision', p.revisionExpr) + elif p.revisionId: + e.setAttribute('revision', p.revisionId) if (p.upstream and (p.upstream != p.revisionExpr or p.upstream != d.upstreamExpr)): e.setAttribute('upstream', p.upstream) 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): result['extras'], ['g1', 'g2', 'g1', 'name:extras', 'all', 'path:path']) + def test_project_set_revision_id(self): + """Check setting of project's revisionId.""" + manifest = self.getXmlManifest(""" + + + + + +""") + self.assertEqual(len(manifest.projects), 1) + project = manifest.projects[0] + project.SetRevisionId('ABCDEF') + self.assertEqual( + manifest.ToXml().toxml(), + '' + + '' + + '' + + '' + + '') + def test_include_levels(self): root_m = os.path.join(self.manifest_dir, 'root.xml') with open(root_m, 'w') as fp: