summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-05-04 12:32:13 -0700
committerRaman Tenneti <rtenneti@google.com>2021-05-04 22:36:01 +0000
commit1c3f57e8f13d4f6dc818bdf06c3a40f768ef1ce5 (patch)
treef9bb9fdaa2859f53104b435d0f7d3202337ec1d9 /manifest_xml.py
parent05638bf77193d53a8568600345733265e4c6a42c (diff)
downloadgit-repo-1c3f57e8f13d4f6dc818bdf06c3a40f768ef1ce5.tar.gz
manifest_xml: initial support for <contactinfo>
It will be used to let manifest authors self-register contact info. This element can be repeated, and any later entries will clobber earlier ones. This would allow manifest authors who extend manifests to specify their own contact info. It would have 1 required attribute: bugurl. "bugurl" specifies the URL to file a bug against the manifest owner. <contactinfo bugurl="bug-url"/> TODO: This CL only implements the parsing logic and further work will be in followup CLs. Tested the code with the following commands. $ ./run_tests tests/test_manifest_xml.py $ ./run_tests -v Bug: [google internal] b/186220520. Change-Id: I47e765ba2dab5cdf850191129f4d4cd6b803f451 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305203 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.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 73556a5e..e1d630b3 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -479,6 +479,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
479 e.setAttribute('remote', remoteName) 479 e.setAttribute('remote', remoteName)
480 root.appendChild(e) 480 root.appendChild(e)
481 481
482 if self._contactinfo:
483 root.appendChild(doc.createTextNode(''))
484 e = doc.createElement('contactinfo')
485 e.setAttribute('bugurl', self._contactinfo['bugurl'])
486 root.appendChild(e)
487
482 return doc 488 return doc
483 489
484 def ToDict(self, **kwargs): 490 def ToDict(self, **kwargs):
@@ -490,6 +496,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
490 'manifest-server', 496 'manifest-server',
491 'repo-hooks', 497 'repo-hooks',
492 'superproject', 498 'superproject',
499 'contactinfo',
493 } 500 }
494 # Elements that may be repeated. 501 # Elements that may be repeated.
495 MULTI_ELEMENTS = { 502 MULTI_ELEMENTS = {
@@ -566,6 +573,11 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
566 return self._superproject 573 return self._superproject
567 574
568 @property 575 @property
576 def contactinfo(self):
577 self._Load()
578 return self._contactinfo
579
580 @property
569 def notice(self): 581 def notice(self):
570 self._Load() 582 self._Load()
571 return self._notice 583 return self._notice
@@ -634,6 +646,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
634 self._default = None 646 self._default = None
635 self._repo_hooks_project = None 647 self._repo_hooks_project = None
636 self._superproject = {} 648 self._superproject = {}
649 self._contactinfo = {}
637 self._notice = None 650 self._notice = None
638 self.branch = None 651 self.branch = None
639 self._manifest_server = None 652 self._manifest_server = None
@@ -876,6 +889,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
876 raise ManifestParseError("no remote for superproject %s within %s" % 889 raise ManifestParseError("no remote for superproject %s within %s" %
877 (name, self.manifestFile)) 890 (name, self.manifestFile))
878 self._superproject['remote'] = remote.ToRemoteSpec(name) 891 self._superproject['remote'] = remote.ToRemoteSpec(name)
892 if node.nodeName == 'contactinfo':
893 bugurl = self._reqatt(node, 'bugurl')
894 # This element can be repeated, later entries will clobber earlier ones.
895 self._contactinfo['bugurl'] = bugurl
879 if node.nodeName == 'remove-project': 896 if node.nodeName == 'remove-project':
880 name = self._reqatt(node, 'name') 897 name = self._reqatt(node, 'name')
881 898