diff options
Diffstat (limited to 'manifest_xml.py')
| -rw-r--r-- | manifest_xml.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index ad0017cc..00659316 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -292,8 +292,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 292 | if r.revision is not None: | 292 | if r.revision is not None: |
| 293 | e.setAttribute('revision', r.revision) | 293 | e.setAttribute('revision', r.revision) |
| 294 | 294 | ||
| 295 | def _ParseGroups(self, groups): | 295 | def _ParseList(self, field): |
| 296 | return [x for x in re.split(r'[,\s]+', groups) if x] | 296 | """Parse fields that contain flattened lists. |
| 297 | |||
| 298 | These are whitespace & comma separated. Empty elements will be discarded. | ||
| 299 | """ | ||
| 300 | return [x for x in re.split(r'[,\s]+', field) if x] | ||
| 297 | 301 | ||
| 298 | def ToXml(self, peg_rev=False, peg_rev_upstream=True, peg_rev_dest_branch=True, groups=None): | 302 | def ToXml(self, peg_rev=False, peg_rev_upstream=True, peg_rev_dest_branch=True, groups=None): |
| 299 | """Return the current manifest XML.""" | 303 | """Return the current manifest XML.""" |
| @@ -302,7 +306,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 302 | if groups is None: | 306 | if groups is None: |
| 303 | groups = mp.config.GetString('manifest.groups') | 307 | groups = mp.config.GetString('manifest.groups') |
| 304 | if groups: | 308 | if groups: |
| 305 | groups = self._ParseGroups(groups) | 309 | groups = self._ParseList(groups) |
| 306 | 310 | ||
| 307 | doc = xml.dom.minidom.Document() | 311 | doc = xml.dom.minidom.Document() |
| 308 | root = doc.createElement('manifest') | 312 | root = doc.createElement('manifest') |
| @@ -754,7 +758,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 754 | path = node.getAttribute('path') | 758 | path = node.getAttribute('path') |
| 755 | groups = node.getAttribute('groups') | 759 | groups = node.getAttribute('groups') |
| 756 | if groups: | 760 | if groups: |
| 757 | groups = self._ParseGroups(groups) | 761 | groups = self._ParseList(groups) |
| 758 | revision = node.getAttribute('revision') | 762 | revision = node.getAttribute('revision') |
| 759 | remote = node.getAttribute('remote') | 763 | remote = node.getAttribute('remote') |
| 760 | if remote: | 764 | if remote: |
| @@ -776,7 +780,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 776 | if node.nodeName == 'repo-hooks': | 780 | if node.nodeName == 'repo-hooks': |
| 777 | # Get the name of the project and the (space-separated) list of enabled. | 781 | # Get the name of the project and the (space-separated) list of enabled. |
| 778 | repo_hooks_project = self._reqatt(node, 'in-project') | 782 | repo_hooks_project = self._reqatt(node, 'in-project') |
| 779 | enabled_repo_hooks = self._reqatt(node, 'enabled-list').split() | 783 | enabled_repo_hooks = self._ParseList(self._reqatt(node, 'enabled-list')) |
| 780 | 784 | ||
| 781 | # Only one project can be the hooks project | 785 | # Only one project can be the hooks project |
| 782 | if self._repo_hooks_project is not None: | 786 | if self._repo_hooks_project is not None: |
| @@ -989,7 +993,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 989 | groups = '' | 993 | groups = '' |
| 990 | if node.hasAttribute('groups'): | 994 | if node.hasAttribute('groups'): |
| 991 | groups = node.getAttribute('groups') | 995 | groups = node.getAttribute('groups') |
| 992 | groups = self._ParseGroups(groups) | 996 | groups = self._ParseList(groups) |
| 993 | 997 | ||
| 994 | if parent is None: | 998 | if parent is None: |
| 995 | relpath, worktree, gitdir, objdir, use_git_worktrees = \ | 999 | relpath, worktree, gitdir, objdir, use_git_worktrees = \ |
