Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.revwalk

public Class BitmappedReachabilityChecker

extends Object
implements ReachabilityChecker
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.revwalk.ReachabilityChecker
Imports
java.io.IOException, java.util.ArrayList, .Collection, .Iterator, .List, .Optional, java.util.stream.Stream, org.eclipse.jgit.errors.IncorrectObjectTypeException, .MissingObjectException, org.eclipse.jgit.lib.BitmapIndex, .BitmapIndex.Bitmap, .BitmapIndex.BitmapBuilder, .Constants, org.eclipse.jgit.revwalk.ReachabilityChecker, .RevCommit, .RevFlag, .RevSort, .RevWalk, org.eclipse.jgit.revwalk.filter.RevFilter

Checks the reachability using bitmaps.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
BitmappedReachabilityChecker.ReachedFilter

This filter emits commits that were not bitmap-reachable from anything visited before.

Field Summary

Modifier and TypeField and Description
private final RevWalk

Constructor Summary

AccessConstructor and Description
public
BitmappedReachabilityChecker(RevWalk
walk on the repository to get or create the bitmaps for the commits. It must have bitmaps.
walk
)

Method Summary

Modifier and TypeMethod and Description
public Optional<RevCommit>
areAllReachable(Collection<RevCommit>
commits to reach.
targets
,
Stream<RevCommit>
known starting points.
starters
)

Implements org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

Check all targets are reachable from the starters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

walkback to summary
private final RevWalk walk

Constructor Detail

BitmappedReachabilityCheckerback to summary
public BitmappedReachabilityChecker(RevWalk walk) throws IOException
Parameters
walk:RevWalk

walk on the repository to get or create the bitmaps for the commits. It must have bitmaps.

Exceptions
IOException:
if the index or the object reader cannot be opened.
AssertionError:
runtime exception if walk is over a repository without bitmaps

Method Detail

areAllReachableback to summary
public Optional<RevCommit> areAllReachable(Collection<RevCommit> targets, Stream<RevCommit> starters) throws MissingObjectException, IncorrectObjectTypeException, IOException

Implements org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

Check all targets are reachable from the starters.

In this implementation, it is recommended to put the most popular starters (e.g. refs/heads tips) at the beginning.

Parameters
targets:Collection<RevCommit>

Doc from org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

commits to reach.

starters:Stream<RevCommit>

Doc from org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

known starting points.

Returns:Optional<RevCommit>

Doc from org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

An unreachable target if at least one of the targets is unreachable. An empty optional if all targets are reachable from the starters.

Annotations
@Override
Exceptions
MissingObjectException:

Doc from org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

if any of the incoming objects doesn't exist in the repository.

IncorrectObjectTypeException:

Doc from org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

if any of the incoming objects is not a commit or a tag.

IOException:

Doc from org.eclipse.jgit.revwalk.ReachabilityChecker.areAllReachable.

if any of the underlying indexes or readers can not be opened.

org.eclipse.jgit.internal.revwalk back to summary

private Class BitmappedReachabilityChecker.ReachedFilter

extends RevFilter
Class Inheritance

This filter emits commits that were not bitmap-reachable from anything visited before. Or in other words, commits that add something (themselves or their bitmap) to the "reached" bitmap. Current progress can be queried via isReachable(RevCommit).

Field Summary

Modifier and TypeField and Description
private final BitmapIndex.BitmapBuilder
private final BitmapIndex
Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
ALLMERGE_BASENO_MERGESNONEONLY_MERGES

Constructor Summary

AccessConstructor and Description
public
ReachedFilter(BitmapIndex
bitmap index of the repo
repoBitmaps
)

Create a filter that emits only previously unreachable commits.

Method Summary

Modifier and TypeMethod and Description
public final RevFilter
clone()

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.clone.

Creates and returns a copy of this object.

private static final void
public final boolean
include(RevWalk
the active walker this filter is being invoked from within.
walker
,
RevCommit
the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from requiresCommitBody().
cmit
)

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.include.

Determine if the supplied commit should be included in results.

pack-priv boolean
public final boolean
requiresCommitBody()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Whether the filter needs the commit body to be parsed.

Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
negatetoString

Field Detail

reachedback to summary
private final BitmapIndex.BitmapBuilder reached
repoBitmapsback to summary
private final BitmapIndex repoBitmaps

Constructor Detail

ReachedFilterback to summary
public ReachedFilter(BitmapIndex repoBitmaps)

Create a filter that emits only previously unreachable commits.

Parameters
repoBitmaps:BitmapIndex

bitmap index of the repo

Method Detail

cloneback to summary
public final RevFilter clone()

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.clone.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Clone this revision filter, including its parameters.

This is a deep clone. If this filter embeds objects or other filters it must also clone those, to ensure the instances do not share mutable data.

Returns:RevFilter

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
dontFollowback to summary
private static final void dontFollow(RevCommit cmit)
includeback to summary
public final boolean include(RevWalk walker, RevCommit cmit)

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.include.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.include.

Determine if the supplied commit should be included in results.

Parameters
walker:RevWalk

the active walker this filter is being invoked from within.

cmit:RevCommit

the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from requiresCommitBody().

Returns:boolean

true to include this commit in the results; false to have this commit be omitted entirely from the results.

Annotations
@Override
isReachableback to summary
pack-priv boolean isReachable(RevCommit commit)
requiresCommitBodyback to summary
public final boolean requiresCommitBody()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Whether the filter needs the commit body to be parsed.

Returns:boolean

true if the filter needs the commit body to be parsed.

Annotations
@Override