in src/main/java/com/googlesource/gerrit/plugins/multisite/validation/MultisiteReplicationPushFilter.java [62:103]
public List<RemoteRefUpdate> filter(String projectName, List<RemoteRefUpdate> remoteUpdatesList) {
Set<String> outdatedChanges = new HashSet<>();
try (Repository repository =
gitRepositoryManager.openRepository(Project.nameKey(projectName))) {
List<RemoteRefUpdate> filteredRefUpdates =
remoteUpdatesList.stream()
.filter(
refUpdate -> {
boolean refUpToDate = isUpToDateWithRetry(projectName, repository, refUpdate);
if (!refUpToDate) {
repLog.warn(
"{} is not up-to-date with the shared-refdb and thus will NOT BE replicated",
refUpdate);
if (refUpdate.getSrcRef().endsWith(REF_META_SUFFIX)) {
outdatedChanges.add(getRootChangeRefPrefix(refUpdate.getSrcRef()));
}
}
return refUpToDate;
})
.collect(Collectors.toList());
return filteredRefUpdates.stream()
.filter(
refUpdate -> {
if (outdatedChanges.contains(changePrefix(refUpdate.getSrcRef()))) {
repLog.warn(
"{} belongs to an outdated /meta ref and thus will NOT BE replicated",
refUpdate);
return false;
}
return true;
})
.collect(Collectors.toList());
} catch (IOException ioe) {
String message = String.format("Error while opening project: '%s'", projectName);
repLog.error(message);
logger.atSevere().withCause(ioe).log(message);
return Collections.emptyList();
}
}