Cleanup the PatchListCache API

Change-Id: I946366b7e0fe98465ce9d347bd7c634d469f342c
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2010-11-15 12:21:31 -08:00
parent 0365b824a2
commit 936e709212
3 changed files with 8 additions and 14 deletions

View File

@ -139,7 +139,8 @@ class PatchScriptBuilder {
if (intralineDifference) {
if (isModify(content)) {
IntraLineDiff d = patchListCache.get(a.id, a.src, b.id, b.src, edits);
IntraLineDiff d =
patchListCache.getIntraLineDiff(a.id, a.src, b.id, b.src, edits);
if (d != null) {
edits = new ArrayList<Edit>(d.getEdits());
} else {

View File

@ -16,7 +16,6 @@ package com.google.gerrit.server.patch;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.AccountDiffPreference.Whitespace;
import org.eclipse.jgit.diff.Edit;
import org.eclipse.jgit.lib.ObjectId;
@ -29,8 +28,6 @@ public interface PatchListCache {
public PatchList get(Change change, PatchSet patchSet);
public PatchList get(Change change, PatchSet patchSet, Whitespace whitespace);
public IntraLineDiff get(ObjectId aId, Text aText, ObjectId bId, Text bText,
List<Edit> edits);
public IntraLineDiff getIntraLineDiff(ObjectId aId, Text aText, ObjectId bId,
Text bText, List<Edit> edits);
}

View File

@ -90,20 +90,16 @@ public class PatchListCacheImpl implements PatchListCache {
}
public PatchList get(final Change change, final PatchSet patchSet) {
return get(change, patchSet, Whitespace.IGNORE_NONE);
}
public PatchList get(final Change change, final PatchSet patchSet,
final Whitespace whitespace) {
final Project.NameKey projectKey = change.getProject();
final ObjectId a = null;
final ObjectId b = ObjectId.fromString(patchSet.getRevision().get());
return get(new PatchListKey(projectKey, a, b, whitespace));
final Whitespace ws = Whitespace.IGNORE_NONE;
return get(new PatchListKey(projectKey, a, b, ws));
}
@Override
public IntraLineDiff get(ObjectId aId, Text aText, ObjectId bId, Text bText,
List<Edit> edits) {
public IntraLineDiff getIntraLineDiff(ObjectId aId, Text aText, ObjectId bId,
Text bText, List<Edit> edits) {
if (computeIntraline) {
IntraLineDiffKey key =
new IntraLineDiffKey(aId, aText, bId, bText, edits);