Allow parent projects to block children from overriding labels
A label section with "canOverride = false" means attempting to override this label in a child project is a no-op. Change-Id: Idf80d807572035aa504ec7e013ec3a53b0719738
This commit is contained in:
@@ -344,16 +344,23 @@ public class ProjectState {
|
||||
});
|
||||
}
|
||||
|
||||
private void putLabelType(Map<String, LabelType> types, LabelType type) {
|
||||
LabelType old = types.get(type.getName());
|
||||
if (old == null || old.canOverride()) {
|
||||
types.put(type.getName(), type);
|
||||
}
|
||||
}
|
||||
|
||||
public LabelTypes getLabelTypes() {
|
||||
Map<String, LabelType> types = Maps.newLinkedHashMap();
|
||||
for (LabelType type : dbLabelTypes.getLabelTypes()) {
|
||||
types.put(type.getName(), type);
|
||||
putLabelType(types, type);
|
||||
}
|
||||
List<ProjectState> projects = Lists.newArrayList(tree());
|
||||
Collections.reverse(projects);
|
||||
for (ProjectState s : projects) {
|
||||
for (LabelType type : s.getConfig().getLabelSections()) {
|
||||
types.put(type.getName(), type);
|
||||
putLabelType(types, type);
|
||||
}
|
||||
}
|
||||
List<LabelType> all = Lists.newArrayListWithCapacity(types.size());
|
||||
|
Reference in New Issue
Block a user