diff options
author | Colin Cross <ccross@android.com> | 2012-03-28 20:15:45 -0700 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2012-04-13 09:46:00 -0700 |
commit | 5acde75e5d70b323197ffb2c9d4fdea3612098f5 (patch) | |
tree | e995a64614ce7406633ae6e99c2a0e6f86872e09 /command.py | |
parent | d67872d2f47b2f09a0e2aa4adfd62e6f69154c9b (diff) | |
download | git-repo-5acde75e5d70b323197ffb2c9d4fdea3612098f5.tar.gz |
Add manifest groupsv1.8.2
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 <sop@google.com>
Tested-by: Shawn Pearce <sop@google.com>
Diffstat (limited to 'command.py')
-rw-r--r-- | command.py | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -15,9 +15,11 @@ | |||
15 | 15 | ||
16 | import os | 16 | import os |
17 | import optparse | 17 | import optparse |
18 | import re | ||
18 | import sys | 19 | import sys |
19 | 20 | ||
20 | from error import NoSuchProjectError | 21 | from error import NoSuchProjectError |
22 | from error import InvalidProjectGroupsError | ||
21 | 23 | ||
22 | class Command(object): | 24 | class Command(object): |
23 | """Base class for any command line action in repo. | 25 | """Base class for any command line action in repo. |
@@ -63,9 +65,16 @@ class Command(object): | |||
63 | all = self.manifest.projects | 65 | all = self.manifest.projects |
64 | result = [] | 66 | result = [] |
65 | 67 | ||
68 | mp = self.manifest.manifestProject | ||
69 | |||
70 | groups = mp.config.GetString('manifest.groups') | ||
71 | if groups: | ||
72 | groups = re.split('[,\s]+', groups) | ||
73 | |||
66 | if not args: | 74 | if not args: |
67 | for project in all.values(): | 75 | for project in all.values(): |
68 | if missing_ok or project.Exists: | 76 | if ((missing_ok or project.Exists) and |
77 | project.MatchesGroups(groups)): | ||
69 | result.append(project) | 78 | result.append(project) |
70 | else: | 79 | else: |
71 | by_path = None | 80 | by_path = None |
@@ -102,6 +111,8 @@ class Command(object): | |||
102 | raise NoSuchProjectError(arg) | 111 | raise NoSuchProjectError(arg) |
103 | if not missing_ok and not project.Exists: | 112 | if not missing_ok and not project.Exists: |
104 | raise NoSuchProjectError(arg) | 113 | raise NoSuchProjectError(arg) |
114 | if not project.MatchesGroups(groups): | ||
115 | raise InvalidProjectGroupsError(arg) | ||
105 | 116 | ||
106 | result.append(project) | 117 | result.append(project) |
107 | 118 | ||