diff --git a/command.py b/command.py index 4dbe2e7..5789582 100644 --- a/command.py +++ b/command.py @@ -70,7 +70,7 @@ class Command(object): groups = mp.config.GetString('manifest.groups') if not groups: - groups = 'default,platform-' + platform.system().lower() + groups = 'all,-notdefault,platform-' + platform.system().lower() groups = [x for x in re.split('[,\s]+', groups) if x] if not args: diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index 338e021..f499868 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt @@ -184,11 +184,12 @@ the default element is used. Attribute `groups`: List of groups to which this project belongs, whitespace or comma separated. All projects belong to the group -"default", and each project automatically belongs to a group of -it's name:`name` and path:`path`. E.g. for +"all", and each project automatically belongs to a group of +its name:`name` and path:`path`. E.g. for , that project definition is implicitly in the following manifest groups: -default, name:monkeys, and path:barrel-of. +default, name:monkeys, and path:barrel-of. If you place a project in the +group "notdefault", it will not be automatically downloaded by repo. Element annotation ------------------ diff --git a/manifest_xml.py b/manifest_xml.py index 205e4af..65b7637 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -130,7 +130,7 @@ class XmlManifest(object): groups = mp.config.GetString('manifest.groups') if not groups: - groups = 'default' + groups = 'all' groups = [x for x in re.split(r'[,\s]+', groups) if x] doc = xml.dom.minidom.Document() @@ -211,7 +211,7 @@ class XmlManifest(object): ce.setAttribute('dest', c.dest) e.appendChild(ce) - default_groups = ['default', 'name:%s' % p.name, 'path:%s' % p.relpath] + default_groups = ['all', 'name:%s' % p.name, 'path:%s' % p.relpath] egroups = [g for g in p.groups if g not in default_groups] if egroups: e.setAttribute('groups', ','.join(egroups)) diff --git a/project.py b/project.py index 06baccb..60633b7 100644 --- a/project.py +++ b/project.py @@ -632,20 +632,21 @@ class Project(object): """Returns true if the manifest groups specified at init should cause this project to be synced. Prefixing a manifest group with "-" inverts the meaning of a group. - All projects are implicitly labelled with "default". + All projects are implicitly labelled with "all". labels are resolved in order. In the example case of - project_groups: "default,group1,group2" + project_groups: "all,group1,group2" manifest_groups: "-group1,group2" the project will be matched. """ - if self.groups is None: - return True + expanded_manifest_groups = manifest_groups or ['all', '-notdefault'] + expanded_project_groups = ['all'] + (self.groups or []) + matched = False - for group in manifest_groups: - if group.startswith('-') and group[1:] in self.groups: + for group in expanded_manifest_groups: + if group.startswith('-') and group[1:] in expanded_project_groups: matched = False - elif group in self.groups: + elif group in expanded_project_groups: matched = True return matched diff --git a/subcmds/init.py b/subcmds/init.py index b16f57c..9a4f711 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -90,12 +90,12 @@ to update the working directory files. dest='depth', help='create a shallow clone with given depth; see git clone') g.add_option('-g', '--groups', - dest='groups', default='default', + dest='groups', default='all,-notdefault', help='restrict manifest projects to ones with a specified group', metavar='GROUP') g.add_option('-p', '--platform', dest='platform', default='auto', - help='restrict manifest projects to ones with a specified' + help='restrict manifest projects to ones with a specified ' 'platform group [auto|all|none|linux|darwin|...]', metavar='PLATFORM') @@ -164,7 +164,7 @@ to update the working directory files. groups = [x for x in groups if x] groupstr = ','.join(groups) - if opt.platform == 'auto' and groupstr == 'default,platform-' + platform.system().lower(): + if opt.platform == 'auto' and groupstr == 'all,-notdefault,platform-' + platform.system().lower(): groupstr = None m.config.SetString('manifest.groups', groupstr)