From 5acde75e5d70b323197ffb2c9d4fdea3612098f5 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 28 Mar 2012 20:15:45 -0700 Subject: Add manifest groups Allows specifying a list of groups with a -g argument to repo init. The groups act on a group= attribute specified on projects in the manifest. All projects are implicitly labelled with "default" unless they are explicitly labelled "-default". Prefixing a group with "-" removes matching projects from the list of projects to sync. If any non-inverted manifest groups are specified, the default label is ignored. Change-Id: I3a0dd7a93a8a1756205de1d03eee8c00906af0e5 Reviewed-on: https://gerrit-review.googlesource.com/34570 Reviewed-by: Shawn Pearce Tested-by: Shawn Pearce --- command.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'command.py') diff --git a/command.py b/command.py index 8e93787e..724e4c5d 100644 --- a/command.py +++ b/command.py @@ -15,9 +15,11 @@ import os import optparse +import re import sys from error import NoSuchProjectError +from error import InvalidProjectGroupsError class Command(object): """Base class for any command line action in repo. @@ -63,9 +65,16 @@ class Command(object): all = self.manifest.projects result = [] + mp = self.manifest.manifestProject + + groups = mp.config.GetString('manifest.groups') + if groups: + groups = re.split('[,\s]+', groups) + if not args: for project in all.values(): - if missing_ok or project.Exists: + if ((missing_ok or project.Exists) and + project.MatchesGroups(groups)): result.append(project) else: by_path = None @@ -102,6 +111,8 @@ class Command(object): raise NoSuchProjectError(arg) if not missing_ok and not project.Exists: raise NoSuchProjectError(arg) + if not project.MatchesGroups(groups): + raise InvalidProjectGroupsError(arg) result.append(project) -- cgit v1.2.3-54-g00ecf