in java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java [195:238]
private Set<ConfigEntry> parseConfiguration(PluginConfigFactory cfgFactory, String name)
throws NoSuchProjectException {
Config cfg = cfgFactory.getProjectPluginConfig(allProjectsName, name);
Set<ConfigEntry> newConf = new HashSet<>();
Set<String> destinations = new HashSet<>();
Set<String> wildcardDestinations = new HashSet<>();
Set<String> sources = new HashSet<>();
for (String sect : cfg.getSections()) {
if (!sect.equals(ConfigEntry.SECTION_NAME)) {
warn("%s.config: ignoring invalid section %s", name, sect);
}
}
for (String subsect : cfg.getSubsections(ConfigEntry.SECTION_NAME)) {
try {
ConfigEntry configEntry = new ConfigEntry(cfg, subsect);
if (destinations.contains(configEntry.srcRepoKey.get())
|| sources.contains(configEntry.destRepoKey.get())) {
// Don't want cyclic dependencies.
throw new ConfigInvalidException(
String.format("repo in entry %s cannot be both source and destination", configEntry));
}
if (configEntry.destBranch.equals("*")) {
if (wildcardDestinations.contains(configEntry.destRepoKey.get())) {
throw new ConfigInvalidException(
String.format(
"repo %s already has a wildcard destination branch.", configEntry.destRepoKey));
}
wildcardDestinations.add(configEntry.destRepoKey.get());
}
sources.add(configEntry.srcRepoKey.get());
destinations.add(configEntry.destRepoKey.get());
newConf.add(configEntry);
} catch (ConfigInvalidException e) {
error("invalid configuration: %s", e);
}
}
return newConf;
}