diff options
| author | Conley Owens <cco3@android.com> | 2012-04-16 10:36:08 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2012-04-23 12:39:05 -0700 |
| commit | 971de8ea7b7e474a4d9253b6c9f47da3f1130973 (patch) | |
| tree | d8ac52741957b38d57d15f208e57b984d71ddc19 /manifest_xml.py | |
| parent | 24c130884018364f91baa8de0ff3541f4c32d1bb (diff) | |
| download | git-repo-971de8ea7b7e474a4d9253b6c9f47da3f1130973.tar.gz | |
Refine groups functionality
Every project is in group "default". "-default" does not remove
it from this project. All group names specified in the manifest
are positive names as opposed to a mix of negative and positive.
Specified groups are resolved in order. If init is supplied with
--groups="group1,-group2", the following describes the project
selection when syncing:
* all projects in "group1" will be added, and
* all projects in "group2" will be removed.
Change-Id: I1df3dcdb64bbd4cd80d675f9b2d3becbf721f661
Diffstat (limited to 'manifest_xml.py')
| -rw-r--r-- | manifest_xml.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 9b804da9..5ffc49e9 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -122,8 +122,9 @@ class XmlManifest(object): | |||
| 122 | mp = self.manifestProject | 122 | mp = self.manifestProject |
| 123 | 123 | ||
| 124 | groups = mp.config.GetString('manifest.groups') | 124 | groups = mp.config.GetString('manifest.groups') |
| 125 | if groups: | 125 | if groups is None: |
| 126 | groups = re.split('[,\s]+', groups) | 126 | groups = 'default' |
| 127 | groups = [x for x in re.split(r'[,\s]+', groups) if x] | ||
| 127 | 128 | ||
| 128 | doc = xml.dom.minidom.Document() | 129 | doc = xml.dom.minidom.Document() |
| 129 | root = doc.createElement('manifest') | 130 | root = doc.createElement('manifest') |
| @@ -200,8 +201,9 @@ class XmlManifest(object): | |||
| 200 | ce.setAttribute('dest', c.dest) | 201 | ce.setAttribute('dest', c.dest) |
| 201 | e.appendChild(ce) | 202 | e.appendChild(ce) |
| 202 | 203 | ||
| 203 | if p.groups: | 204 | egroups = [g for g in p.groups if g != 'default'] |
| 204 | e.setAttribute('groups', ','.join(p.groups)) | 205 | if egroups: |
| 206 | e.setAttribute('groups', ','.join(egroups)) | ||
| 205 | 207 | ||
| 206 | for a in p.annotations: | 208 | for a in p.annotations: |
| 207 | if a.keep == "true": | 209 | if a.keep == "true": |
| @@ -524,11 +526,12 @@ class XmlManifest(object): | |||
| 524 | else: | 526 | else: |
| 525 | rebase = rebase.lower() in ("yes", "true", "1") | 527 | rebase = rebase.lower() in ("yes", "true", "1") |
| 526 | 528 | ||
| 527 | groups = node.getAttribute('groups') | 529 | groups = '' |
| 528 | if groups: | 530 | if node.hasAttribute('groups'): |
| 529 | groups = re.split('[,\s]+', groups) | 531 | groups = node.getAttribute('groups') |
| 530 | else: | 532 | groups = [x for x in re.split('[,\s]+', groups) if x] |
| 531 | groups = None | 533 | if 'default' not in groups: |
| 534 | groups.append('default') | ||
| 532 | 535 | ||
| 533 | if self.IsMirror: | 536 | if self.IsMirror: |
| 534 | relpath = None | 537 | relpath = None |
