From e0b16a22a01c54a00a9e4a0c53dddfce3b0d59d6 Mon Sep 17 00:00:00 2001 From: Xin Li Date: Sun, 26 Sep 2021 23:20:32 -0700 Subject: superproject: support a new revision attribute. Tested: $ ./run_tests Verified that a manifest that specified superproject revision would use the specified revision, and superproject will use the default revision. Note that this is a slight behavior change from earlier repo versions, which would always use the branch name of the manifest itself. However, the new behavior would be more consisitent with regular "project" element and would allow superproject be used even if it is not enabled for the particular manifest branch, so we have decided to make the change as it would provide more flexibility and better matches what other elements would do. Bug: [google internal] b/187868160 Change-Id: I35255ee347aff6e65179f7879d52931f168b477e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/317643 Tested-by: Xin Li Reviewed-by: Raman Tenneti Reviewed-by: Mike Frysinger --- manifest_xml.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 7099d5fe..135c91fb 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -507,6 +507,9 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md if not d.remote or remote.orig_name != remoteName: remoteName = remote.orig_name e.setAttribute('remote', remoteName) + revision = remote.revision or d.revisionExpr + if not revision or revision != self._superproject['revision']: + e.setAttribute('revision', self._superproject['revision']) root.appendChild(e) if self._contactinfo.bugurl != Wrapper().BUG_URL: @@ -914,6 +917,13 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md raise ManifestParseError("no remote for superproject %s within %s" % (name, self.manifestFile)) self._superproject['remote'] = remote.ToRemoteSpec(name) + revision = node.getAttribute('revision') or remote.revision + if not revision: + revision = self._default.revisionExpr + if not revision: + raise ManifestParseError('no revision for superproject %s within %s' % + (name, self.manifestFile)) + self._superproject['revision'] = revision if node.nodeName == 'contactinfo': bugurl = self._reqatt(node, 'bugurl') # This element can be repeated, later entries will clobber earlier ones. -- cgit v1.2.3-54-g00ecf