Remove ChangeAccess.byKey and byKeyRange

All callers of byKeyRange passed key.max() as the right endpoint, so
this can be safely replaced with a prefix query against the secondary
index. The number of callers notwithstanding, this was pretty
straightforward, although it does lead to the almost-recursive state
of calling InternalChangeQuery from ChangeQueryBuilder when expanding
the conflicts predicate.

Change-Id: I073d6ab179d3d5a5d8f0157aa3594fd3ea2cc81c
This commit is contained in:
Dave Borowitz
2015-01-13 17:43:06 -08:00
parent dfc07f63bb
commit f9c88308de
19 changed files with 100 additions and 107 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.acceptance.edit;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.acceptance.GitUtil.cloneProject;
import static com.google.gerrit.acceptance.GitUtil.createProject;
@@ -27,7 +28,6 @@ import static org.junit.Assert.fail;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.PushOneCommit;
@@ -620,8 +620,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
}
private Change getChange(String changeId) throws Exception {
return Iterables.getOnlyElement(db.changes()
.byKey(new Change.Key(changeId)));
return getOnlyElement(queryProvider.get().byKeyPrefix(changeId)).change();
}
private PatchSet getCurrentPatchSet(String changeId) throws Exception {