From ca7daa5226d88c8533c2316e5bc8a66ea8a373c5 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 8 May 2015 22:26:28 -0700 Subject: [PATCH] ObjectReader: remove the walkAdvice API This was added a very long time ago to support the failed DHT storage implementation. Since then no storage system was able to make use of this API, but it pollutes internals of the walkers. Kill the API on ObjectReader and drop the invocations from the walker code. Change-Id: I36608afdac13a6c3084d7c7e0af5e0cb22900332 --- .../org/eclipse/jgit/lib/ObjectReader.java | 41 ------------------- .../jgit/revwalk/MergeBaseGenerator.java | 1 - .../org/eclipse/jgit/revwalk/ObjectWalk.java | 14 ------- .../jgit/revwalk/PendingGenerator.java | 2 - .../eclipse/jgit/revwalk/StartGenerator.java | 2 - 5 files changed, 60 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java index 524dafb88..4c4e53455 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java @@ -53,9 +53,6 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs; -import org.eclipse.jgit.revwalk.ObjectWalk; -import org.eclipse.jgit.revwalk.RevCommit; -import org.eclipse.jgit.revwalk.RevWalk; /** * Reads an {@link ObjectDatabase} for a single thread. @@ -398,44 +395,6 @@ public void release() { }; } - /** - * Advice from a {@link RevWalk} that a walk is starting from these roots. - * - * @param walk - * the revision pool that is using this reader. - * @param roots - * starting points of the revision walk. The starting points have - * their headers parsed, but might be missing bodies. - * @throws IOException - * the reader cannot initialize itself to support the walk. - */ - public void walkAdviceBeginCommits(RevWalk walk, Collection roots) - throws IOException { - // Do nothing by default, most readers don't want or need advice. - } - - /** - * Advice from an {@link ObjectWalk} that trees will be traversed. - * - * @param ow - * the object pool that is using this reader. - * @param min - * the first commit whose root tree will be read. - * @param max - * the last commit whose root tree will be read. - * @throws IOException - * the reader cannot initialize itself to support the walk. - */ - public void walkAdviceBeginTrees(ObjectWalk ow, RevCommit min, RevCommit max) - throws IOException { - // Do nothing by default, most readers don't want or need advice. - } - - /** Advice from that a walk is over. */ - public void walkAdviceEnd() { - // Do nothing by default, most readers don't want or need advice. - } - /** * Advise the reader to avoid unreachable objects. *

diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java index 7822947c9..f1d7dc836 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java @@ -137,7 +137,6 @@ RevCommit next() throws MissingObjectException, for (;;) { final RevCommit c = pending.next(); if (c == null) { - walker.reader.walkAdviceEnd(); return null; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index 27cb0474a..18c4233eb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -99,10 +99,6 @@ public class ObjectWalk extends RevWalk { private BlockObjQueue pendingObjects; - private RevCommit firstCommit; - - private RevCommit lastCommit; - private TreeVisit freeVisit; private TreeVisit currVisit; @@ -260,8 +256,6 @@ public RevCommit next() throws MissingObjectException, for (;;) { final RevCommit r = super.next(); if (r == null) { - if (firstCommit != null) - reader.walkAdviceBeginTrees(this, firstCommit, lastCommit); return null; } if ((r.flags & UNINTERESTING) != 0) { @@ -270,9 +264,6 @@ public RevCommit next() throws MissingObjectException, return r; continue; } - if (firstCommit == null) - firstCommit = r; - lastCommit = r; pendingObjects.add(r.getTree()); return r; } @@ -366,7 +357,6 @@ public RevObject nextObject() throws MissingObjectException, for (;;) { RevObject o = pendingObjects.next(); if (o == null) { - reader.walkAdviceEnd(); return null; } int flags = o.flags; @@ -634,8 +624,6 @@ private void growPathBuf(int ptr) { public void dispose() { super.dispose(); pendingObjects = new BlockObjQueue(); - firstCommit = null; - lastCommit = null; currVisit = null; freeVisit = null; } @@ -649,8 +637,6 @@ protected void reset(final int retainFlags) { rootObjects = new ArrayList(); pendingObjects = new BlockObjQueue(); - firstCommit = null; - lastCommit = null; currVisit = null; freeVisit = null; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java index f24c27873..94ae2c993 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java @@ -128,7 +128,6 @@ RevCommit next() throws MissingObjectException, for (;;) { final RevCommit c = pending.next(); if (c == null) { - walker.reader.walkAdviceEnd(); return null; } @@ -177,7 +176,6 @@ else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { - walker.reader.walkAdviceEnd(); pending.clear(); return null; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java index 02469d6de..1ec629031 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java @@ -85,8 +85,6 @@ RevCommit next() throws MissingObjectException, final TreeFilter tf = w.getTreeFilter(); AbstractRevQueue q = walker.queue; - w.reader.walkAdviceBeginCommits(w, w.roots); - if (rf == RevFilter.MERGE_BASE) { // Computing for merge bases is a special case and does not // use the bulk of the generator pipeline.