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: I36608afdac13a6c3084d7c7e0af5e0cb22900332tags/v4.0.0.201505191015-rc1
import org.eclipse.jgit.errors.IncorrectObjectTypeException; | import org.eclipse.jgit.errors.IncorrectObjectTypeException; | ||||
import org.eclipse.jgit.errors.MissingObjectException; | import org.eclipse.jgit.errors.MissingObjectException; | ||||
import org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs; | 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. | * Reads an {@link ObjectDatabase} for a single thread. | ||||
}; | }; | ||||
} | } | ||||
/** | |||||
* 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<RevCommit> 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. | * Advise the reader to avoid unreachable objects. | ||||
* <p> | * <p> |
for (;;) { | for (;;) { | ||||
final RevCommit c = pending.next(); | final RevCommit c = pending.next(); | ||||
if (c == null) { | if (c == null) { | ||||
walker.reader.walkAdviceEnd(); | |||||
return null; | return null; | ||||
} | } | ||||
private BlockObjQueue pendingObjects; | private BlockObjQueue pendingObjects; | ||||
private RevCommit firstCommit; | |||||
private RevCommit lastCommit; | |||||
private TreeVisit freeVisit; | private TreeVisit freeVisit; | ||||
private TreeVisit currVisit; | private TreeVisit currVisit; | ||||
for (;;) { | for (;;) { | ||||
final RevCommit r = super.next(); | final RevCommit r = super.next(); | ||||
if (r == null) { | if (r == null) { | ||||
if (firstCommit != null) | |||||
reader.walkAdviceBeginTrees(this, firstCommit, lastCommit); | |||||
return null; | return null; | ||||
} | } | ||||
if ((r.flags & UNINTERESTING) != 0) { | if ((r.flags & UNINTERESTING) != 0) { | ||||
return r; | return r; | ||||
continue; | continue; | ||||
} | } | ||||
if (firstCommit == null) | |||||
firstCommit = r; | |||||
lastCommit = r; | |||||
pendingObjects.add(r.getTree()); | pendingObjects.add(r.getTree()); | ||||
return r; | return r; | ||||
} | } | ||||
for (;;) { | for (;;) { | ||||
RevObject o = pendingObjects.next(); | RevObject o = pendingObjects.next(); | ||||
if (o == null) { | if (o == null) { | ||||
reader.walkAdviceEnd(); | |||||
return null; | return null; | ||||
} | } | ||||
int flags = o.flags; | int flags = o.flags; | ||||
public void dispose() { | public void dispose() { | ||||
super.dispose(); | super.dispose(); | ||||
pendingObjects = new BlockObjQueue(); | pendingObjects = new BlockObjQueue(); | ||||
firstCommit = null; | |||||
lastCommit = null; | |||||
currVisit = null; | currVisit = null; | ||||
freeVisit = null; | freeVisit = null; | ||||
} | } | ||||
rootObjects = new ArrayList<RevObject>(); | rootObjects = new ArrayList<RevObject>(); | ||||
pendingObjects = new BlockObjQueue(); | pendingObjects = new BlockObjQueue(); | ||||
firstCommit = null; | |||||
lastCommit = null; | |||||
currVisit = null; | currVisit = null; | ||||
freeVisit = null; | freeVisit = null; | ||||
} | } |
for (;;) { | for (;;) { | ||||
final RevCommit c = pending.next(); | final RevCommit c = pending.next(); | ||||
if (c == null) { | if (c == null) { | ||||
walker.reader.walkAdviceEnd(); | |||||
return null; | return null; | ||||
} | } | ||||
c.disposeBody(); | c.disposeBody(); | ||||
} | } | ||||
} catch (StopWalkException swe) { | } catch (StopWalkException swe) { | ||||
walker.reader.walkAdviceEnd(); | |||||
pending.clear(); | pending.clear(); | ||||
return null; | return null; | ||||
} | } |
final TreeFilter tf = w.getTreeFilter(); | final TreeFilter tf = w.getTreeFilter(); | ||||
AbstractRevQueue q = walker.queue; | AbstractRevQueue q = walker.queue; | ||||
w.reader.walkAdviceBeginCommits(w, w.roots); | |||||
if (rf == RevFilter.MERGE_BASE) { | if (rf == RevFilter.MERGE_BASE) { | ||||
// Computing for merge bases is a special case and does not | // Computing for merge bases is a special case and does not | ||||
// use the bulk of the generator pipeline. | // use the bulk of the generator pipeline. |