Merge changes from topic 'load-changes-via-change-notes-factory'

* changes:
  ScanningChangeCacheImpl: Load changes from notedb if enabled
  ChangeControl.GenericFactory#validateFor: Don't load change from db
  ChangeControl.GenericFactory: Use ChangeNotes.Factory to load change
  Pass project to ChangeData so that it can load the change from notes
  Store project field in change index
  ChangesCollection: Lookup change in index when legacy ID is given
  Always load change notes when they are created
  Load change via notes factory in ConsistencyChecker#checkExpectMergedAs()
  PostReview#forceCallerAsReviewer should set reviewer in notedb
  Use ChangeNotes in more places to load the change
  Load change in ChangeNotes.Factory
  Fix parsing of current patch set from notes branch
  Remove unused method in ChangeDataResultSet
  ChangeJson: Remove unused format(Collection<Change.Id>) method
This commit is contained in:
Dave Borowitz
2016-02-05 17:38:59 +00:00
committed by Gerrit Code Review
76 changed files with 553 additions and 323 deletions

View File

@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.gerrit.server.git.QueueProvider.QueueType.INTERACTIVE;
import static com.google.gerrit.server.index.ChangeField.LEGACY_ID;
import static com.google.gerrit.server.index.ChangeField.PROJECT;
import static com.google.gerrit.server.index.IndexRewriter.CLOSED_STATUSES;
import static com.google.gerrit.server.index.IndexRewriter.OPEN_STATUSES;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -34,6 +35,7 @@ import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.config.ConfigUtil;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -454,7 +456,9 @@ public class LuceneChangeIndex implements ChangeIndex {
ChangeProtoField.CODEC.decode(cb.bytes, cb.offset, cb.length));
} else {
int id = doc.getField(idFieldName).numericValue().intValue();
cd = changeDataFactory.create(db.get(), new Change.Id(id));
Project.NameKey project =
new Project.NameKey(doc.getField(PROJECT.getName()).stringValue());
cd = changeDataFactory.create(db.get(), project, new Change.Id(id));
}
if (fields.contains(PATCH_SET_FIELD)) {