summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2012-04-16 10:36:08 -0700
committerShawn O. Pearce <sop@google.com>2012-04-23 12:39:05 -0700
commit971de8ea7b7e474a4d9253b6c9f47da3f1130973 (patch)
treed8ac52741957b38d57d15f208e57b984d71ddc19 /subcmds/init.py
parent24c130884018364f91baa8de0ff3541f4c32d1bb (diff)
downloadgit-repo-971de8ea7b7e474a4d9253b6c9f47da3f1130973.tar.gz
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
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py10
1 files changed, 8 insertions, 2 deletions
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 @@
14# limitations under the License. 14# limitations under the License.
15 15
16import os 16import os
17import re
17import shutil 18import shutil
18import sys 19import sys
19 20
@@ -87,7 +88,7 @@ to update the working directory files.
87 dest='depth', 88 dest='depth',
88 help='create a shallow clone with given depth; see git clone') 89 help='create a shallow clone with given depth; see git clone')
89 g.add_option('-g', '--groups', 90 g.add_option('-g', '--groups',
90 dest='groups', default="", 91 dest='groups', default='default',
91 help='restrict manifest projects to ones with a specified group', 92 help='restrict manifest projects to ones with a specified group',
92 metavar='GROUP') 93 metavar='GROUP')
93 94
@@ -139,7 +140,12 @@ to update the working directory files.
139 r.ResetFetch() 140 r.ResetFetch()
140 r.Save() 141 r.Save()
141 142
142 m.config.SetString('manifest.groups', opt.groups) 143 groups = re.split('[,\s]+', opt.groups)
144 groups = [x for x in groups if x]
145 groupstr = ','.join(groups)
146 if groupstr == 'default':
147 groupstr = None
148 m.config.SetString('manifest.groups', groupstr)
143 149
144 if opt.reference: 150 if opt.reference:
145 m.config.SetString('repo.reference', opt.reference) 151 m.config.SetString('repo.reference', opt.reference)