mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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 <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
339f2df1dd
commit
993af5e136
@ -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()
|
||||
|
@ -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')
|
||||
|
||||
|
@ -576,7 +576,7 @@ class ContactinfoElementTests(ManifestParseTestCase):
|
||||
<contactinfo bugurl="{bugurl}"/>
|
||||
</manifest>
|
||||
""")
|
||||
self.assertEqual(manifest.contactinfo['bugurl'], bugurl)
|
||||
self.assertEqual(manifest.contactinfo.bugurl, bugurl)
|
||||
self.assertEqual(
|
||||
manifest.ToXml().toxml(),
|
||||
'<?xml version="1.0" ?><manifest>'
|
||||
|
Loading…
Reference in New Issue
Block a user