diff --git a/git_superproject.py b/git_superproject.py index 04e2078d..3168d9f8 100644 --- a/git_superproject.py +++ b/git_superproject.py @@ -28,7 +28,6 @@ import sys from git_command import GitCommand from git_refs import R_HEADS -from wrapper import Wrapper _SUPERPROJECT_GIT_NAME = 'superproject.git' _SUPERPROJECT_MANIFEST_NAME = 'superproject_override.xml' @@ -283,7 +282,7 @@ class Superproject(object): projects_missing_commit_ids.append(path) if projects_missing_commit_ids: print('error: please file a bug using %s to report missing commit_ids for: %s' % - (Wrapper().BUG_URL, projects_missing_commit_ids), file=sys.stderr) + (self._manifest.contactinfo.bugurl, projects_missing_commit_ids), file=sys.stderr) return None manifest_path = self._WriteManfiestFile() 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') diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 6095c720..99848e57 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -576,7 +576,7 @@ class ContactinfoElementTests(ManifestParseTestCase): """) - self.assertEqual(manifest.contactinfo['bugurl'], bugurl) + self.assertEqual(manifest.contactinfo.bugurl, bugurl) self.assertEqual( manifest.ToXml().toxml(), ''