From bb1b5f5f863fca0e85764f5b35c117f5724d15c0 Mon Sep 17 00:00:00 2001 From: Conley Owens Date: Mon, 13 Aug 2012 13:11:18 -0700 Subject: Allow projects to be specified as notdefault Instead of every group being in the group "default", every project is now in the group "all". A group that should not be downloaded by default may be added to the group "notdefault". This allows all group names to be positive (instead of removing groups directly in the manifest with -default) and offers a clear way of selecting every project (--groups all). Change-Id: I99cd70309adb1f8460db3bbc6eff46bdcd22256f --- project.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'project.py') diff --git a/project.py b/project.py index 06baccb5..60633b73 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 -- cgit v1.2.3-54-g00ecf