diff options
Diffstat (limited to 'manifest_xml.py')
| -rw-r--r-- | manifest_xml.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 95c67d73..ad0017cc 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -637,7 +637,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 637 | 637 | ||
| 638 | self._loaded = True | 638 | self._loaded = True |
| 639 | 639 | ||
| 640 | def _ParseManifestXml(self, path, include_root): | 640 | def _ParseManifestXml(self, path, include_root, parent_groups=''): |
| 641 | try: | 641 | try: |
| 642 | root = xml.dom.minidom.parse(path) | 642 | root = xml.dom.minidom.parse(path) |
| 643 | except (OSError, xml.parsers.expat.ExpatError) as e: | 643 | except (OSError, xml.parsers.expat.ExpatError) as e: |
| @@ -656,12 +656,17 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 656 | for node in manifest.childNodes: | 656 | for node in manifest.childNodes: |
| 657 | if node.nodeName == 'include': | 657 | if node.nodeName == 'include': |
| 658 | name = self._reqatt(node, 'name') | 658 | name = self._reqatt(node, 'name') |
| 659 | include_groups = '' | ||
| 660 | if parent_groups: | ||
| 661 | include_groups = parent_groups | ||
| 662 | if node.hasAttribute('groups'): | ||
| 663 | include_groups = node.getAttribute('groups') + ',' + include_groups | ||
| 659 | fp = os.path.join(include_root, name) | 664 | fp = os.path.join(include_root, name) |
| 660 | if not os.path.isfile(fp): | 665 | if not os.path.isfile(fp): |
| 661 | raise ManifestParseError("include %s doesn't exist or isn't a file" | 666 | raise ManifestParseError("include %s doesn't exist or isn't a file" |
| 662 | % (name,)) | 667 | % (name,)) |
| 663 | try: | 668 | try: |
| 664 | nodes.extend(self._ParseManifestXml(fp, include_root)) | 669 | nodes.extend(self._ParseManifestXml(fp, include_root, include_groups)) |
| 665 | # should isolate this to the exact exception, but that's | 670 | # should isolate this to the exact exception, but that's |
| 666 | # tricky. actual parsing implementation may vary. | 671 | # tricky. actual parsing implementation may vary. |
| 667 | except (KeyboardInterrupt, RuntimeError, SystemExit): | 672 | except (KeyboardInterrupt, RuntimeError, SystemExit): |
| @@ -670,6 +675,11 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 670 | raise ManifestParseError( | 675 | raise ManifestParseError( |
| 671 | "failed parsing included manifest %s: %s" % (name, e)) | 676 | "failed parsing included manifest %s: %s" % (name, e)) |
| 672 | else: | 677 | else: |
| 678 | if parent_groups and node.nodeName == 'project': | ||
| 679 | nodeGroups = parent_groups | ||
| 680 | if node.hasAttribute('groups'): | ||
| 681 | nodeGroups = node.getAttribute('groups') + ',' + nodeGroups | ||
| 682 | node.setAttribute('groups', nodeGroups) | ||
| 673 | nodes.append(node) | 683 | nodes.append(node) |
| 674 | return nodes | 684 | return nodes |
| 675 | 685 | ||
