Fix compile errors
We merged 2 changes that don't work together. I618178 removed change notes from EventFactory and I1c2fbd added another usage of change notes to this class. Undo the modifications from I1c2fbd that require change notes in EventFactory. Change-Id: I414c4ae9e15056e868c72201dc9ab7dfde466542 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.change;
|
package com.google.gerrit.server.change;
|
||||||
|
|
||||||
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
|
||||||
import com.google.gerrit.server.project.ProjectState;
|
import com.google.gerrit.server.project.ProjectState;
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
@@ -32,5 +32,5 @@ public interface ChangeKindCache {
|
|||||||
ChangeKind getChangeKind(ProjectState project, Repository repo,
|
ChangeKind getChangeKind(ProjectState project, Repository repo,
|
||||||
ObjectId prior, ObjectId next);
|
ObjectId prior, ObjectId next);
|
||||||
|
|
||||||
ChangeKind getChangeKind(ReviewDb db, ChangeNotes notes, PatchSet patch);
|
ChangeKind getChangeKind(ReviewDb db, Change change, PatchSet patch);
|
||||||
}
|
}
|
||||||
|
@@ -22,13 +22,13 @@ import com.google.common.annotations.VisibleForTesting;
|
|||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.Weigher;
|
import com.google.common.cache.Weigher;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
import com.google.gerrit.server.cache.CacheModule;
|
import com.google.gerrit.server.cache.CacheModule;
|
||||||
import com.google.gerrit.server.config.GerritServerConfig;
|
import com.google.gerrit.server.config.GerritServerConfig;
|
||||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||||
import com.google.gerrit.server.git.MergeUtil;
|
import com.google.gerrit.server.git.MergeUtil;
|
||||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
|
||||||
import com.google.gerrit.server.project.ProjectCache;
|
import com.google.gerrit.server.project.ProjectCache;
|
||||||
import com.google.gerrit.server.project.ProjectState;
|
import com.google.gerrit.server.project.ProjectState;
|
||||||
import com.google.gerrit.server.query.change.ChangeData;
|
import com.google.gerrit.server.query.change.ChangeData;
|
||||||
@@ -110,9 +110,9 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangeKind getChangeKind(ReviewDb db, ChangeNotes notes,
|
public ChangeKind getChangeKind(ReviewDb db, Change change,
|
||||||
PatchSet patch) {
|
PatchSet patch) {
|
||||||
return getChangeKindInternal(this, db, notes, patch, changeDataFactory,
|
return getChangeKindInternal(this, db, change, patch, changeDataFactory,
|
||||||
projectCache, repoManager);
|
projectCache, repoManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -327,15 +327,15 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangeKind getChangeKind(ReviewDb db, ChangeNotes notes, PatchSet patch) {
|
public ChangeKind getChangeKind(ReviewDb db, Change change, PatchSet patch) {
|
||||||
return getChangeKindInternal(this, db, notes, patch, changeDataFactory,
|
return getChangeKindInternal(this, db, change, patch, changeDataFactory,
|
||||||
projectCache, repoManager);
|
projectCache, repoManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChangeKind getChangeKindInternal(
|
private static ChangeKind getChangeKindInternal(
|
||||||
ChangeKindCache cache,
|
ChangeKindCache cache,
|
||||||
ReviewDb db,
|
ReviewDb db,
|
||||||
ChangeNotes notes,
|
Change change,
|
||||||
PatchSet patch,
|
PatchSet patch,
|
||||||
ChangeData.Factory changeDataFactory,
|
ChangeData.Factory changeDataFactory,
|
||||||
ProjectCache projectCache,
|
ProjectCache projectCache,
|
||||||
@@ -345,9 +345,9 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
|
|||||||
// Trivial case: if we're on the first patch, we don't need to open
|
// Trivial case: if we're on the first patch, we don't need to open
|
||||||
// the repository.
|
// the repository.
|
||||||
if (patch.getId().get() > 1) {
|
if (patch.getId().get() > 1) {
|
||||||
try (Repository repo = repoManager.openRepository(notes.getProjectName())) {
|
try (Repository repo = repoManager.openRepository(change.getProject())) {
|
||||||
ProjectState projectState = projectCache.checkedGet(notes.getProjectName());
|
ProjectState projectState = projectCache.checkedGet(change.getProject());
|
||||||
ChangeData cd = changeDataFactory.create(db, notes);
|
ChangeData cd = changeDataFactory.create(db, change);
|
||||||
Collection<PatchSet> patchSetCollection = cd.patchSets();
|
Collection<PatchSet> patchSetCollection = cd.patchSets();
|
||||||
PatchSet priorPs = patch;
|
PatchSet priorPs = patch;
|
||||||
for (PatchSet ps : patchSetCollection) {
|
for (PatchSet ps : patchSetCollection) {
|
||||||
@@ -372,7 +372,7 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
|
|||||||
} catch (IOException | OrmException e) {
|
} catch (IOException | OrmException e) {
|
||||||
// Do nothing; assume we have a complex change
|
// Do nothing; assume we have a complex change
|
||||||
log.warn("Unable to get change kind for patchSet " + patch.getPatchSetId() +
|
log.warn("Unable to get change kind for patchSet " + patch.getPatchSetId() +
|
||||||
"of change " + notes.getChangeId(), e);
|
"of change " + change.getChangeId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return kind;
|
return kind;
|
||||||
|
@@ -505,7 +505,7 @@ public class EventFactory {
|
|||||||
p.sizeInsertions += pe.getInsertions();
|
p.sizeInsertions += pe.getInsertions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.kind = changeKindCache.getChangeKind(db, notes, patchSet);
|
p.kind = changeKindCache.getChangeKind(db, change, patchSet);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Cannot load patch set data for " + patchSet.getId(), e);
|
log.error("Cannot load patch set data for " + patchSet.getId(), e);
|
||||||
} catch (PatchListNotAvailableException e) {
|
} catch (PatchListNotAvailableException e) {
|
||||||
|
Reference in New Issue
Block a user