in src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java [251:271]
public Set<String> getDownstreamBranches(String fromBranch, String project)
throws RestApiException, IOException, ConfigInvalidException {
Set<String> downstreamBranches = new HashSet<>();
// List all subsections of automerger, split by :
Set<String> subsections = getConfig().getSubsections(pluginName);
for (String subsection : subsections) {
// Subsections are of the form "fromBranch:toBranch"
String[] branchPair = subsection.split(Pattern.quote(BRANCH_DELIMITER));
if (branchPair.length != 2) {
throw new ConfigInvalidException("Automerger config branch pair malformed: " + subsection);
}
if (fromBranch.equals(branchPair[0])) {
// If fromBranches match, check if project is in both their manifests
Set<String> projectsInScope = getProjectsInScope(branchPair[0], branchPair[1]);
if (projectsInScope.contains(project)) {
downstreamBranches.add(branchPair[1]);
}
}
}
return downstreamBranches;
}