From 993af5e136030ba9822f9a19e338e35ecc9581c7 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Wed, 12 May 2021 12:00:31 -0700 Subject: superproject: Use bugurl from contactinfo in the missing commits error message. + In XmlManifest._Unload set 'bugurl' to Wrapper().BUG_URL. + contactinfo returns a namedtuple. + bug_url can be accessed as self._manifest.contactinfo.bugurl. Tested the code with the following commands. $ ./run_tests -v Added contactinfo tag to default.xml and verified that bugurl is used. Bug: [google internal] b/186220520. Change-Id: Iaafd6465e072b2e47a0a0b548bf6cb608a0b0a04 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/306342 Tested-by: Raman Tenneti Reviewed-by: Mike Frysinger --- manifest_xml.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index e1d630b3..9cbdcd18 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import collections import itertools import os import platform @@ -27,11 +28,15 @@ import platform_utils from project import RemoteSpec, Project, MetaProject from error import (ManifestParseError, ManifestInvalidPathError, ManifestInvalidRevisionError) +from wrapper import Wrapper MANIFEST_FILE_NAME = 'manifest.xml' LOCAL_MANIFEST_NAME = 'local_manifest.xml' LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' +# ContactInfo has the self-registered bug url, supplied by the manifest authors. +ContactInfo = collections.namedtuple('ContactInfo', 'bugurl') + # urljoin gets confused if the scheme is not known. urllib.parse.uses_relative.extend([ 'ssh', @@ -479,10 +484,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md e.setAttribute('remote', remoteName) root.appendChild(e) - if self._contactinfo: + if self._contactinfo.bugurl != Wrapper().BUG_URL: root.appendChild(doc.createTextNode('')) e = doc.createElement('contactinfo') - e.setAttribute('bugurl', self._contactinfo['bugurl']) + e.setAttribute('bugurl', self._contactinfo.bugurl) root.appendChild(e) return doc @@ -646,7 +651,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md self._default = None self._repo_hooks_project = None self._superproject = {} - self._contactinfo = {} + self._contactinfo = ContactInfo(Wrapper().BUG_URL) self._notice = None self.branch = None self._manifest_server = None @@ -892,7 +897,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md if node.nodeName == 'contactinfo': bugurl = self._reqatt(node, 'bugurl') # This element can be repeated, later entries will clobber earlier ones. - self._contactinfo['bugurl'] = bugurl + self._contactinfo = ContactInfo(bugurl) + if node.nodeName == 'remove-project': name = self._reqatt(node, 'name') -- cgit v1.2.3-54-g00ecf