summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Harring <ferringb@chromium.org>2012-06-15 02:24:20 -0700
committerShawn O. Pearce <sop@google.com>2012-07-31 22:05:44 -0700
commit7da1314e38a2bb2941511c9003fa388eddb55c0a (patch)
tree21eb19cb1edb13fc0931fbef074d3dd36e5dc7ba
parent435370c6f0e202378ae233cf1088e499ba07e971 (diff)
downloadgit-repo-7da1314e38a2bb2941511c9003fa388eddb55c0a.tar.gz
Inject the project name into each projects groups.
For CrOS, we have scenarios were people checkout a smaller version of our manifest via groups, and enable individual repositories as needed for their work. Previously this was via local_manifest manipulation, which breaks via manifest-groups would require a remove-project tag. Via injecting the projects name into the projects groups, this allows us to instead manipulate the configured groups allowing the user to turn on/off projects as necessary. Change-Id: I07b7918e16cc9dc28eb47e19a46a04dc4fd0be74
-rw-r--r--docs/manifest-format.txt6
-rw-r--r--manifest_xml.py5
2 files changed, 8 insertions, 3 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt
index 9f4585b8..a827f556 100644
--- a/docs/manifest-format.txt
+++ b/docs/manifest-format.txt
@@ -171,7 +171,11 @@ the default element is used.
171 171
172Attribute `groups`: List of groups to which this project belongs, 172Attribute `groups`: List of groups to which this project belongs,
173whitespace or comma separated. All projects belong to the group 173whitespace or comma separated. All projects belong to the group
174"default". 174"default", and each project automatically belongs to a group of
175it's name:`name` and path:`path`. E.g. for
176<project name="monkeys" path="barrel-of"/>, that project
177definition is implicitly in the following manifest groups:
178default, name:monkeys, and path:barrel-of.
175 179
176Element annotation 180Element annotation
177------------------ 181------------------
diff --git a/manifest_xml.py b/manifest_xml.py
index a46cf24e..86899f63 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -566,8 +566,9 @@ class XmlManifest(object):
566 if node.hasAttribute('groups'): 566 if node.hasAttribute('groups'):
567 groups = node.getAttribute('groups') 567 groups = node.getAttribute('groups')
568 groups = [x for x in re.split('[,\s]+', groups) if x] 568 groups = [x for x in re.split('[,\s]+', groups) if x]
569 if 'default' not in groups: 569
570 groups.append('default') 570 default_groups = ['default', 'name:%s' % name, 'path:%s' % path]
571 groups.extend(set(default_groups).difference(groups))
571 572
572 if self.IsMirror: 573 if self.IsMirror:
573 relpath = None 574 relpath = None