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 /subcmds | |
| parent | d67872d2f47b2f09a0e2aa4adfd62e6f69154c9b (diff) | |
| download | git-repo-14bd527f4e467dccf62a0fdaf16f18992d512aa8.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 'subcmds')
| -rw-r--r-- | subcmds/init.py | 6 | ||||
| -rw-r--r-- | subcmds/sync.py | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 1cba3665..6cf39d14 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -86,6 +86,10 @@ to update the working directory files. | |||
| 86 | g.add_option('--depth', type='int', default=None, | 86 | g.add_option('--depth', type='int', default=None, |
| 87 | dest='depth', | 87 | dest='depth', |
| 88 | help='create a shallow clone with given depth; see git clone') | 88 | help='create a shallow clone with given depth; see git clone') |
| 89 | g.add_option('-g', '--groups', | ||
| 90 | dest='groups', default="", | ||
| 91 | help='restrict manifest projects to ones with a specified group', | ||
| 92 | metavar='GROUP') | ||
| 89 | 93 | ||
| 90 | # Tool | 94 | # Tool |
| 91 | g = p.add_option_group('repo Version options') | 95 | g = p.add_option_group('repo Version options') |
| @@ -135,6 +139,8 @@ to update the working directory files. | |||
| 135 | r.ResetFetch() | 139 | r.ResetFetch() |
| 136 | r.Save() | 140 | r.Save() |
| 137 | 141 | ||
| 142 | m.config.SetString('manifest.groups', opt.groups) | ||
| 143 | |||
| 138 | if opt.reference: | 144 | if opt.reference: |
| 139 | m.config.SetString('repo.reference', opt.reference) | 145 | m.config.SetString('repo.reference', opt.reference) |
| 140 | 146 | ||
diff --git a/subcmds/sync.py b/subcmds/sync.py index 74b3f183..63227afd 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -277,7 +277,7 @@ later is required to fix a server side protocol bug. | |||
| 277 | 277 | ||
| 278 | def UpdateProjectList(self): | 278 | def UpdateProjectList(self): |
| 279 | new_project_paths = [] | 279 | new_project_paths = [] |
| 280 | for project in self.manifest.projects.values(): | 280 | for project in self.GetProjects(None, missing_ok=True): |
| 281 | if project.relpath: | 281 | if project.relpath: |
| 282 | new_project_paths.append(project.relpath) | 282 | new_project_paths.append(project.relpath) |
| 283 | file_name = 'project.list' | 283 | file_name = 'project.list' |
| @@ -306,7 +306,8 @@ later is required to fix a server side protocol bug. | |||
| 306 | worktree = os.path.join(self.manifest.topdir, path), | 306 | worktree = os.path.join(self.manifest.topdir, path), |
| 307 | relpath = path, | 307 | relpath = path, |
| 308 | revisionExpr = 'HEAD', | 308 | revisionExpr = 'HEAD', |
| 309 | revisionId = None) | 309 | revisionId = None, |
| 310 | groups = None) | ||
| 310 | 311 | ||
| 311 | if project.IsDirty(): | 312 | if project.IsDirty(): |
| 312 | print >>sys.stderr, 'error: Cannot remove project "%s": \ | 313 | print >>sys.stderr, 'error: Cannot remove project "%s": \ |
