mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Special handling for manifest group "default"
Change Details: * Make "default" a special manifest group that matches any project that does not have the special project group "notdefault" * Use "default" instead of "all,-notdefault" when user does not specify manifest group * Expand -g option help to include example usage of manifest groups Change Benefits: * Allow a more intuitive and expressive manifest groups specification: * "default" instead of "all,-notdefault" * "default,foo" instead of "all,-notdefault,foo" * "default,-foo" instead of "all,-notdefault,-foo" * "foo,-default" which has no equivalent * Default manifest groups behavior can be restored by the command 'repo init -g default'. This is significantly more intuitive than the current equivalent command 'repo init -g all,-notdefault'. Change-Id: I6d0673791d64a650110a917c248bcebb23b279d3
This commit is contained in:
parent
33e0456737
commit
0a1c6a1c16
@ -136,7 +136,7 @@ class Command(object):
|
|||||||
|
|
||||||
groups = mp.config.GetString('manifest.groups')
|
groups = mp.config.GetString('manifest.groups')
|
||||||
if not groups:
|
if not groups:
|
||||||
groups = 'all,-notdefault,platform-' + platform.system().lower()
|
groups = 'default,platform-' + platform.system().lower()
|
||||||
groups = [x for x in re.split(r'[,\s]+', groups) if x]
|
groups = [x for x in re.split(r'[,\s]+', groups) if x]
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
|
@ -672,9 +672,14 @@ class Project(object):
|
|||||||
project_groups: "all,group1,group2"
|
project_groups: "all,group1,group2"
|
||||||
manifest_groups: "-group1,group2"
|
manifest_groups: "-group1,group2"
|
||||||
the project will be matched.
|
the project will be matched.
|
||||||
|
|
||||||
|
The special manifest group "default" will match any project that
|
||||||
|
does not have the special project group "notdefault"
|
||||||
"""
|
"""
|
||||||
expanded_manifest_groups = manifest_groups or ['all', '-notdefault']
|
expanded_manifest_groups = manifest_groups or ['default']
|
||||||
expanded_project_groups = ['all'] + (self.groups or [])
|
expanded_project_groups = ['all'] + (self.groups or [])
|
||||||
|
if not 'notdefault' in expanded_project_groups:
|
||||||
|
expanded_project_groups += ['default']
|
||||||
|
|
||||||
matched = False
|
matched = False
|
||||||
for group in expanded_manifest_groups:
|
for group in expanded_manifest_groups:
|
||||||
|
3
repo
3
repo
@ -164,7 +164,8 @@ group.add_option('--depth', type='int', default=None,
|
|||||||
help='create a shallow clone with given depth; see git clone')
|
help='create a shallow clone with given depth; see git clone')
|
||||||
group.add_option('-g', '--groups',
|
group.add_option('-g', '--groups',
|
||||||
dest='groups', default='default',
|
dest='groups', default='default',
|
||||||
help='restrict manifest projects to ones with a specified group',
|
help='restrict manifest projects to ones with specified '
|
||||||
|
'group(s) [default|all|G1,G2,G3|G4,-G5,-G6]',
|
||||||
metavar='GROUP')
|
metavar='GROUP')
|
||||||
group.add_option('-p', '--platform',
|
group.add_option('-p', '--platform',
|
||||||
dest='platform', default="auto",
|
dest='platform', default="auto",
|
||||||
|
@ -91,8 +91,9 @@ to update the working directory files.
|
|||||||
dest='depth',
|
dest='depth',
|
||||||
help='create a shallow clone with given depth; see git clone')
|
help='create a shallow clone with given depth; see git clone')
|
||||||
g.add_option('-g', '--groups',
|
g.add_option('-g', '--groups',
|
||||||
dest='groups', default='all,-notdefault',
|
dest='groups', default='default',
|
||||||
help='restrict manifest projects to ones with a specified group',
|
help='restrict manifest projects to ones with specified '
|
||||||
|
'group(s) [default|all|G1,G2,G3|G4,-G5,-G6]',
|
||||||
metavar='GROUP')
|
metavar='GROUP')
|
||||||
g.add_option('-p', '--platform',
|
g.add_option('-p', '--platform',
|
||||||
dest='platform', default='auto',
|
dest='platform', default='auto',
|
||||||
@ -169,7 +170,7 @@ to update the working directory files.
|
|||||||
|
|
||||||
groups = [x for x in groups if x]
|
groups = [x for x in groups if x]
|
||||||
groupstr = ','.join(groups)
|
groupstr = ','.join(groups)
|
||||||
if opt.platform == 'auto' and groupstr == 'all,-notdefault,platform-' + platform.system().lower():
|
if opt.platform == 'auto' and groupstr == 'default,platform-' + platform.system().lower():
|
||||||
groupstr = None
|
groupstr = None
|
||||||
m.config.SetString('manifest.groups', groupstr)
|
m.config.SetString('manifest.groups', groupstr)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user