ChangeBundle: Fix ChangeMessage comparison for extra patch sets

We were only excluding messages for patch sets that don't exist in the
full, unfiltered set of PatchSet.Ids. But there might be extraneous
patch sets that actually do exist in the bundle, but are greater than
the current patch set ID on the change. We were already filtering
these out for other entity types in limitToValidPatchSets, just not
for ChangeBundle, which uses a slightly different implementation.

Change-Id: Id1a0a9462f4096deee7a1d1a6eb673bc37529958
This commit is contained in:
Dave Borowitz
2016-05-27 20:12:03 -04:00
parent f85a569184
commit cb4c481f77
2 changed files with 38 additions and 1 deletions

View File

@@ -403,12 +403,16 @@ public class ChangeBundle {
}
private Collection<ChangeMessage> filterChangeMessages() {
final Predicate<PatchSet.Id> upToCurrent = upToCurrentPredicate();
return Collections2.filter(changeMessages,
new Predicate<ChangeMessage>() {
@Override
public boolean apply(ChangeMessage in) {
PatchSet.Id psId = in.getPatchSetId();
return psId == null || patchSets.containsKey(psId);
if (psId == null) {
return true;
}
return upToCurrent.apply(psId) && patchSets.containsKey(psId);
}
});
}