Fix MESSAGES and CURRENT_REVISION to only return current revision

In ac60c6e530 a bug was introduced causing all revisions to be
returned if the caller asked for both MESSAGES and CURRENT_REVISION.
Filter the revisions obtained from the database to only the current.

Change-Id: I5098704e482cbe8dceb66b9dcdbba2c8547e27d2
This commit is contained in:
Shawn Pearce
2014-05-02 17:18:11 -07:00
parent ddc78c4262
commit 583edad07e

View File

@@ -808,7 +808,9 @@ public class ChangeJson {
Map<String, RevisionInfo> res = Maps.newLinkedHashMap();
for (PatchSet in : map.values()) {
if (ctl.isPatchVisible(in, db.get())) {
if ((has(ALL_REVISIONS)
|| in.getId().equals(cd.change().currentPatchSetId()))
&& ctl.isPatchVisible(in, db.get())) {
res.put(in.getRevision().get(), toRevisionInfo(cd, in, project));
}
}