From 971de8ea7b7e474a4d9253b6c9f47da3f1130973 Mon Sep 17 00:00:00 2001 From: Conley Owens Date: Mon, 16 Apr 2012 10:36:08 -0700 Subject: 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 --- subcmds/init.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'subcmds/init.py') diff --git a/subcmds/init.py b/subcmds/init.py index 6cf39d14..d1c497c1 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -14,6 +14,7 @@ # limitations under the License. import os +import re import shutil import sys @@ -87,7 +88,7 @@ to update the working directory files. dest='depth', help='create a shallow clone with given depth; see git clone') g.add_option('-g', '--groups', - dest='groups', default="", + dest='groups', default='default', help='restrict manifest projects to ones with a specified group', metavar='GROUP') @@ -139,7 +140,12 @@ to update the working directory files. r.ResetFetch() r.Save() - m.config.SetString('manifest.groups', opt.groups) + groups = re.split('[,\s]+', opt.groups) + groups = [x for x in groups if x] + groupstr = ','.join(groups) + if groupstr == 'default': + groupstr = None + m.config.SetString('manifest.groups', groupstr) if opt.reference: m.config.SetString('repo.reference', opt.reference) -- cgit v1.2.3-54-g00ecf