I see the code, that is handling exactly that use case in automerger plugin.
src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
// Returns contents of manifest file for the given branch pair
// If manifest does not exist, return empty set.
private Set<String> getManifestProjects(String fromBranch, String toBranch)
throws RestApiException, IOException, ConfigInvalidException {
boolean ignoreSourceManifest =
getConfig()
.getBoolean(
"automerger",
fromBranch + BRANCH_DELIMITER + toBranch,
"ignoreSourceManifest",
false);
Set<String> toProjects =
getProjectsInManifest(getManifestProject(), getManifestFile(), toBranch);
if (ignoreSourceManifest) {
return toProjects;
}
Set<String> fromProjects =
getProjectsInManifest(getManifestProject(), getManifestFile(), fromBranch);
fromProjects.retainAll(toProjects);
return fromProjects;
}
Where getProjectsInManifest() is defined as:
private Set<String> getProjectsInManifest(
String manifestProject, String manifestFile, String branch)
throws RestApiException, IOException {
try (BinaryResult manifestConfig =
gApi.projects().name(manifestProject).branch(branch).file(manifestFile)) {
ManifestReader manifestReader = new ManifestReader(branch, manifestConfig.asString());
return manifestReader.getProjects();
} catch (ResourceNotFoundException e) {
log.debug("Manifest for {} not found", branch);
return new HashSet<>();
}
}
As you can see ManifestReader is supposed to return the projects:
ManifestReader manifestReader = new ManifestReader(branch, manifestConfig.asString());
return manifestReader.getProjects();
And looking at ManifestReader implementation:
public Set<String> getProjects() {
Set<String> projectSet = new HashSet<>();
try {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(new InputSource(new StringReader(manifestString)));
Element defaultElement = (Element) document.getElementsByTagName("default").item(0);
String defaultRevision = defaultElement.getAttribute("revision");
NodeList projectNodes = document.getElementsByTagName("project");
for (int i = 0; i < projectNodes.getLength(); i++) {
Node projectNode = projectNodes.item(i);
if (projectNode.getNodeType() == Node.ELEMENT_NODE) {
Element projectElement = (Element) projectNode;
String name = projectElement.getAttribute("name");
String revision = projectElement.getAttribute("revision");
if ("".equals(revision)) {
revision = defaultRevision;
}
// Only add to list of projects in scope if revision is same as
// manifest branch
if (revision.equals(branch)) {
projectSet.add(name);
}
^^^ It has this revision/from-branch comparison.
However, in your example they differ: