Don't pass ReviewDb to ChangeData static methods

Assume that all of the ChangeDatas passed to these methods are from
the same context and therefore use the same database handle, so pick
one to use from the passed-in ChangeDatas.

Change-Id: Ic37cba1bd3fbfb987857b86fb67aaaa6c9aaba04
This commit is contained in:
Dave Borowitz
2013-12-23 10:31:26 -08:00
parent cfd54d6e20
commit d7ba1805cc
6 changed files with 21 additions and 31 deletions

View File

@@ -229,16 +229,16 @@ public class ChangeJson {
throws OrmException {
accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS));
Iterable<ChangeData> all = Iterables.concat(in);
ChangeData.ensureChangeLoaded(db, all);
ChangeData.ensureChangeLoaded(all);
if (has(ALL_REVISIONS)) {
ChangeData.ensureAllPatchSetsLoaded(db, all);
ChangeData.ensureAllPatchSetsLoaded(all);
} else {
ChangeData.ensureCurrentPatchSetLoaded(db, all);
ChangeData.ensureCurrentPatchSetLoaded(all);
}
if (has(REVIEWED)) {
ensureReviewedLoaded(all);
}
ChangeData.ensureCurrentApprovalsLoaded(db, all);
ChangeData.ensureCurrentApprovalsLoaded(all);
List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size());
Map<Change.Id, ChangeInfo> out = Maps.newHashMap();