diff options
-rw-r--r-- | git_superproject.py | 3 | ||||
-rw-r--r-- | manifest_xml.py | 14 | ||||
-rw-r--r-- | tests/test_manifest_xml.py | 2 |
3 files changed, 12 insertions, 7 deletions
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 | |||
28 | 28 | ||
29 | from git_command import GitCommand | 29 | from git_command import GitCommand |
30 | from git_refs import R_HEADS | 30 | from git_refs import R_HEADS |
31 | from wrapper import Wrapper | ||
32 | 31 | ||
33 | _SUPERPROJECT_GIT_NAME = 'superproject.git' | 32 | _SUPERPROJECT_GIT_NAME = 'superproject.git' |
34 | _SUPERPROJECT_MANIFEST_NAME = 'superproject_override.xml' | 33 | _SUPERPROJECT_MANIFEST_NAME = 'superproject_override.xml' |
@@ -283,7 +282,7 @@ class Superproject(object): | |||
283 | projects_missing_commit_ids.append(path) | 282 | projects_missing_commit_ids.append(path) |
284 | if projects_missing_commit_ids: | 283 | if projects_missing_commit_ids: |
285 | print('error: please file a bug using %s to report missing commit_ids for: %s' % | 284 | print('error: please file a bug using %s to report missing commit_ids for: %s' % |
286 | (Wrapper().BUG_URL, projects_missing_commit_ids), file=sys.stderr) | 285 | (self._manifest.contactinfo.bugurl, projects_missing_commit_ids), file=sys.stderr) |
287 | return None | 286 | return None |
288 | 287 | ||
289 | manifest_path = self._WriteManfiestFile() | 288 | 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 @@ | |||
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 | ||
15 | import collections | ||
15 | import itertools | 16 | import itertools |
16 | import os | 17 | import os |
17 | import platform | 18 | import platform |
@@ -27,11 +28,15 @@ import platform_utils | |||
27 | from project import RemoteSpec, Project, MetaProject | 28 | from project import RemoteSpec, Project, MetaProject |
28 | from error import (ManifestParseError, ManifestInvalidPathError, | 29 | from error import (ManifestParseError, ManifestInvalidPathError, |
29 | ManifestInvalidRevisionError) | 30 | ManifestInvalidRevisionError) |
31 | from wrapper import Wrapper | ||
30 | 32 | ||
31 | MANIFEST_FILE_NAME = 'manifest.xml' | 33 | MANIFEST_FILE_NAME = 'manifest.xml' |
32 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' | 34 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' |
33 | LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' | 35 | LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' |
34 | 36 | ||
37 | # ContactInfo has the self-registered bug url, supplied by the manifest authors. | ||
38 | ContactInfo = 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. |
36 | urllib.parse.uses_relative.extend([ | 41 | urllib.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 | ||
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): | |||
576 | <contactinfo bugurl="{bugurl}"/> | 576 | <contactinfo bugurl="{bugurl}"/> |
577 | </manifest> | 577 | </manifest> |
578 | """) | 578 | """) |
579 | self.assertEqual(manifest.contactinfo['bugurl'], bugurl) | 579 | self.assertEqual(manifest.contactinfo.bugurl, bugurl) |
580 | self.assertEqual( | 580 | self.assertEqual( |
581 | manifest.ToXml().toxml(), | 581 | manifest.ToXml().toxml(), |
582 | '<?xml version="1.0" ?><manifest>' | 582 | '<?xml version="1.0" ?><manifest>' |