diff options
-rw-r--r-- | command.py | 2 | ||||
-rw-r--r-- | docs/manifest-format.txt | 7 | ||||
-rw-r--r-- | manifest_xml.py | 4 | ||||
-rw-r--r-- | project.py | 15 | ||||
-rw-r--r-- | subcmds/init.py | 6 |
5 files changed, 18 insertions, 16 deletions
@@ -70,7 +70,7 @@ class Command(object): | |||
70 | 70 | ||
71 | groups = mp.config.GetString('manifest.groups') | 71 | groups = mp.config.GetString('manifest.groups') |
72 | if not groups: | 72 | if not groups: |
73 | groups = 'default,platform-' + platform.system().lower() | 73 | groups = 'all,-notdefault,platform-' + platform.system().lower() |
74 | groups = [x for x in re.split('[,\s]+', groups) if x] | 74 | groups = [x for x in re.split('[,\s]+', groups) if x] |
75 | 75 | ||
76 | if not args: | 76 | if not args: |
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index 338e0219..f499868c 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt | |||
@@ -184,11 +184,12 @@ the default element is used. | |||
184 | 184 | ||
185 | Attribute `groups`: List of groups to which this project belongs, | 185 | Attribute `groups`: List of groups to which this project belongs, |
186 | whitespace or comma separated. All projects belong to the group | 186 | whitespace or comma separated. All projects belong to the group |
187 | "default", and each project automatically belongs to a group of | 187 | "all", and each project automatically belongs to a group of |
188 | it's name:`name` and path:`path`. E.g. for | 188 | its name:`name` and path:`path`. E.g. for |
189 | <project name="monkeys" path="barrel-of"/>, that project | 189 | <project name="monkeys" path="barrel-of"/>, that project |
190 | definition is implicitly in the following manifest groups: | 190 | definition is implicitly in the following manifest groups: |
191 | default, name:monkeys, and path:barrel-of. | 191 | default, name:monkeys, and path:barrel-of. If you place a project in the |
192 | group "notdefault", it will not be automatically downloaded by repo. | ||
192 | 193 | ||
193 | Element annotation | 194 | Element annotation |
194 | ------------------ | 195 | ------------------ |
diff --git a/manifest_xml.py b/manifest_xml.py index 205e4af7..65b76379 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -130,7 +130,7 @@ class XmlManifest(object): | |||
130 | 130 | ||
131 | groups = mp.config.GetString('manifest.groups') | 131 | groups = mp.config.GetString('manifest.groups') |
132 | if not groups: | 132 | if not groups: |
133 | groups = 'default' | 133 | groups = 'all' |
134 | groups = [x for x in re.split(r'[,\s]+', groups) if x] | 134 | groups = [x for x in re.split(r'[,\s]+', groups) if x] |
135 | 135 | ||
136 | doc = xml.dom.minidom.Document() | 136 | doc = xml.dom.minidom.Document() |
@@ -211,7 +211,7 @@ class XmlManifest(object): | |||
211 | ce.setAttribute('dest', c.dest) | 211 | ce.setAttribute('dest', c.dest) |
212 | e.appendChild(ce) | 212 | e.appendChild(ce) |
213 | 213 | ||
214 | default_groups = ['default', 'name:%s' % p.name, 'path:%s' % p.relpath] | 214 | default_groups = ['all', 'name:%s' % p.name, 'path:%s' % p.relpath] |
215 | egroups = [g for g in p.groups if g not in default_groups] | 215 | egroups = [g for g in p.groups if g not in default_groups] |
216 | if egroups: | 216 | if egroups: |
217 | e.setAttribute('groups', ','.join(egroups)) | 217 | e.setAttribute('groups', ','.join(egroups)) |
@@ -632,20 +632,21 @@ class Project(object): | |||
632 | """Returns true if the manifest groups specified at init should cause | 632 | """Returns true if the manifest groups specified at init should cause |
633 | this project to be synced. | 633 | this project to be synced. |
634 | Prefixing a manifest group with "-" inverts the meaning of a group. | 634 | Prefixing a manifest group with "-" inverts the meaning of a group. |
635 | All projects are implicitly labelled with "default". | 635 | All projects are implicitly labelled with "all". |
636 | 636 | ||
637 | labels are resolved in order. In the example case of | 637 | labels are resolved in order. In the example case of |
638 | project_groups: "default,group1,group2" | 638 | project_groups: "all,group1,group2" |
639 | manifest_groups: "-group1,group2" | 639 | manifest_groups: "-group1,group2" |
640 | the project will be matched. | 640 | the project will be matched. |
641 | """ | 641 | """ |
642 | if self.groups is None: | 642 | expanded_manifest_groups = manifest_groups or ['all', '-notdefault'] |
643 | return True | 643 | expanded_project_groups = ['all'] + (self.groups or []) |
644 | |||
644 | matched = False | 645 | matched = False |
645 | for group in manifest_groups: | 646 | for group in expanded_manifest_groups: |
646 | if group.startswith('-') and group[1:] in self.groups: | 647 | if group.startswith('-') and group[1:] in expanded_project_groups: |
647 | matched = False | 648 | matched = False |
648 | elif group in self.groups: | 649 | elif group in expanded_project_groups: |
649 | matched = True | 650 | matched = True |
650 | 651 | ||
651 | return matched | 652 | return matched |
diff --git a/subcmds/init.py b/subcmds/init.py index b16f57c4..9a4f7118 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -90,12 +90,12 @@ to update the working directory files. | |||
90 | dest='depth', | 90 | dest='depth', |
91 | help='create a shallow clone with given depth; see git clone') | 91 | help='create a shallow clone with given depth; see git clone') |
92 | g.add_option('-g', '--groups', | 92 | g.add_option('-g', '--groups', |
93 | dest='groups', default='default', | 93 | dest='groups', default='all,-notdefault', |
94 | help='restrict manifest projects to ones with a specified group', | 94 | help='restrict manifest projects to ones with a specified group', |
95 | metavar='GROUP') | 95 | metavar='GROUP') |
96 | g.add_option('-p', '--platform', | 96 | g.add_option('-p', '--platform', |
97 | dest='platform', default='auto', | 97 | dest='platform', default='auto', |
98 | help='restrict manifest projects to ones with a specified' | 98 | help='restrict manifest projects to ones with a specified ' |
99 | 'platform group [auto|all|none|linux|darwin|...]', | 99 | 'platform group [auto|all|none|linux|darwin|...]', |
100 | metavar='PLATFORM') | 100 | metavar='PLATFORM') |
101 | 101 | ||
@@ -164,7 +164,7 @@ to update the working directory files. | |||
164 | 164 | ||
165 | groups = [x for x in groups if x] | 165 | groups = [x for x in groups if x] |
166 | groupstr = ','.join(groups) | 166 | groupstr = ','.join(groups) |
167 | if opt.platform == 'auto' and groupstr == 'default,platform-' + platform.system().lower(): | 167 | if opt.platform == 'auto' and groupstr == 'all,-notdefault,platform-' + platform.system().lower(): |
168 | groupstr = None | 168 | groupstr = None |
169 | m.config.SetString('manifest.groups', groupstr) | 169 | m.config.SetString('manifest.groups', groupstr) |
170 | 170 | ||