summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-05-12 12:00:31 -0700
committerRaman Tenneti <rtenneti@google.com>2021-05-18 15:35:54 +0000
commit993af5e136030ba9822f9a19e338e35ecc9581c7 (patch)
tree372bd79de5c397ea9feb1accf5bb4830293bdee7 /manifest_xml.py
parent339f2df1ddd741070e340ec01d6882dd1eee617c (diff)
downloadgit-repo-993af5e136030ba9822f9a19e338e35ecc9581c7.tar.gz
superproject: Use bugurl from contactinfo in the missing commits error message.v2.15.1
+ 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>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py14
1 files changed, 10 insertions, 4 deletions
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 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15import collections
15import itertools 16import itertools
16import os 17import os
17import platform 18import platform
@@ -27,11 +28,15 @@ import platform_utils
27from project import RemoteSpec, Project, MetaProject 28from project import RemoteSpec, Project, MetaProject
28from error import (ManifestParseError, ManifestInvalidPathError, 29from error import (ManifestParseError, ManifestInvalidPathError,
29 ManifestInvalidRevisionError) 30 ManifestInvalidRevisionError)
31from wrapper import Wrapper
30 32
31MANIFEST_FILE_NAME = 'manifest.xml' 33MANIFEST_FILE_NAME = 'manifest.xml'
32LOCAL_MANIFEST_NAME = 'local_manifest.xml' 34LOCAL_MANIFEST_NAME = 'local_manifest.xml'
33LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' 35LOCAL_MANIFESTS_DIR_NAME = 'local_manifests'
34 36
37# ContactInfo has the self-registered bug url, supplied by the manifest authors.
38ContactInfo = collections.namedtuple('ContactInfo', 'bugurl')
39
35# urljoin gets confused if the scheme is not known. 40# urljoin gets confused if the scheme is not known.
36urllib.parse.uses_relative.extend([ 41urllib.parse.uses_relative.extend([
37 'ssh', 42 'ssh',
@@ -479,10 +484,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
479 e.setAttribute('remote', remoteName) 484 e.setAttribute('remote', remoteName)
480 root.appendChild(e) 485 root.appendChild(e)
481 486
482 if self._contactinfo: 487 if self._contactinfo.bugurl != Wrapper().BUG_URL:
483 root.appendChild(doc.createTextNode('')) 488 root.appendChild(doc.createTextNode(''))
484 e = doc.createElement('contactinfo') 489 e = doc.createElement('contactinfo')
485 e.setAttribute('bugurl', self._contactinfo['bugurl']) 490 e.setAttribute('bugurl', self._contactinfo.bugurl)
486 root.appendChild(e) 491 root.appendChild(e)
487 492
488 return doc 493 return doc
@@ -646,7 +651,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
646 self._default = None 651 self._default = None
647 self._repo_hooks_project = None 652 self._repo_hooks_project = None
648 self._superproject = {} 653 self._superproject = {}
649 self._contactinfo = {} 654 self._contactinfo = ContactInfo(Wrapper().BUG_URL)
650 self._notice = None 655 self._notice = None
651 self.branch = None 656 self.branch = None
652 self._manifest_server = None 657 self._manifest_server = None
@@ -892,7 +897,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
892 if node.nodeName == 'contactinfo': 897 if node.nodeName == 'contactinfo':
893 bugurl = self._reqatt(node, 'bugurl') 898 bugurl = self._reqatt(node, 'bugurl')
894 # This element can be repeated, later entries will clobber earlier ones. 899 # This element can be repeated, later entries will clobber earlier ones.
895 self._contactinfo['bugurl'] = bugurl 900 self._contactinfo = ContactInfo(bugurl)
901
896 if node.nodeName == 'remove-project': 902 if node.nodeName == 'remove-project':
897 name = self._reqatt(node, 'name') 903 name = self._reqatt(node, 'name')
898 904