Enforce label uniqueness in ProjectConfig and ProjectState

Within a single project, it is an error to specify two different
labels that differ only in case. (Multiple [label "Foo"] sections with
the same case are automatically collapsed by JGit.)

Between projects, it is valid to override a label "Foo" in a parent
project with a label "foo" in a child.

Change-Id: Ica6b990feefb272d1675c0f006162afbe51335b5
This commit is contained in:
Dave Borowitz
2013-02-25 14:19:11 -08:00
parent 0e0a41a281
commit 6045c9d956
2 changed files with 12 additions and 2 deletions

View File

@@ -347,9 +347,10 @@ public class ProjectState {
Collections.reverse(projects);
for (ProjectState s : projects) {
for (LabelType type : s.getConfig().getLabelSections().values()) {
LabelType old = types.get(type.getName());
String lower = type.getName().toLowerCase();
LabelType old = types.get(lower);
if (old == null || !old.canOverride()) {
types.put(type.getName(), type);
types.put(lower, type);
}
}
}