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
diff --git a/command.py b/command.py
index 724e4c5..2ee0a43 100644
--- a/command.py
+++ b/command.py
@@ -58,7 +58,7 @@
"""Perform the action, after option parsing is complete.
"""
raise NotImplementedError
-
+
def GetProjects(self, args, missing_ok=False):
"""A list of projects that match the arguments.
"""
@@ -68,8 +68,9 @@
mp = self.manifest.manifestProject
groups = mp.config.GetString('manifest.groups')
- if groups:
- groups = re.split('[,\s]+', groups)
+ if groups is None:
+ groups = 'default'
+ groups = [x for x in re.split('[,\s]+', groups) if x]
if not args:
for project in all.values():