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

public Class TreeRevFilter

extends RevFilter
Class Inheritance
Imports
java.io.IOException, java.util.List, .Optional, .Set, org.eclipse.jgit.internal.storage.commitgraph.ChangedPathFilter, org.eclipse.jgit.diff.DiffConfig, .DiffEntry, .DiffEntry.ChangeType, .RenameDetector, org.eclipse.jgit.errors.CorruptObjectException, .IncorrectObjectTypeException, .MissingObjectException, .StopWalkException, org.eclipse.jgit.lib.ObjectId, org.eclipse.jgit.revwalk.filter.RevFilter, org.eclipse.jgit.treewalk.TreeWalk, org.eclipse.jgit.treewalk.filter.TreeFilter

Filter applying a org.eclipse.jgit.treewalk.filter.TreeFilter against changed paths in each commit.

Each commit is differenced concurrently against all of its parents to look for tree entries that are interesting to the org.eclipse.jgit.treewalk.filter.TreeFilter.

Since
3.5

Field Summary

Modifier and TypeField and Description
private long
private long
private long
private static final int
private static final int
private final TreeWalk
private final int
private static final int
Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
ALLMERGE_BASENO_MERGESNONEONLY_MERGES

Constructor Summary

AccessConstructor and Description
public
TreeRevFilter(RevWalk
walker used for reading trees.
walker
,
TreeFilter
filter to compare against any changed paths in each commit. If a org.eclipse.jgit.revwalk.FollowFilter, will be replaced with a new filter following new paths after a rename.
t
)

Create a org.eclipse.jgit.revwalk.filter.RevFilter from a org.eclipse.jgit.treewalk.filter.TreeFilter.

pack-priv
TreeRevFilter(RevWalk
walker used for reading trees.
walker
,
TreeFilter
filter to compare against any changed paths in each commit. If a FollowFilter, will be replaced with a new filter following new paths after a rename.
t
,
int
flag to color commits to be removed from the simplified DAT.
rewriteFlag
)

Create a filter for the first phase of a parent-rewriting limited revision walk.

Method Summary

Modifier and TypeMethod and Description
public RevFilter
clone()

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

Creates and returns a copy of this object.

public long

Returns:

count of false positives
getChangedPathFilterFalsePositive
()

Return how many times a changed path filter wrongly predicted that a path was changed in a commit, for statistics gathering purposes.

public long

Returns:

count of negatives
getChangedPathFilterNegative
()

Return how many times a changed path filter predicted that a path was not changed in a commit (allowing that commit to be skipped), for statistics gathering purposes.

public long

Returns:

count of true positives
getChangedPathFilterTruePositive
()

Return how many times a changed path filter correctly predicted that a path was changed in a commit, for statistics gathering purposes.

public 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().
c
)

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

Determine if the supplied commit should be included in results.

private static boolean
public boolean
requiresCommitBody()

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

Whether the filter needs the commit body to be parsed.

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

Field Detail

changedPathFilterFalsePositiveback to summary
private long changedPathFilterFalsePositive
changedPathFilterNegativeback to summary
private long changedPathFilterNegative
changedPathFilterTruePositiveback to summary
private long changedPathFilterTruePositive
FILTER_APPLIEDback to summary
private static final int FILTER_APPLIED
PARSEDback to summary
private static final int PARSED
pathFilterback to summary
private final TreeWalk pathFilter
rewriteFlagback to summary
private final int rewriteFlag
UNINTERESTINGback to summary
private static final int UNINTERESTING

Constructor Detail

TreeRevFilterback to summary
public TreeRevFilter(RevWalk walker, TreeFilter t)

Create a org.eclipse.jgit.revwalk.filter.RevFilter from a org.eclipse.jgit.treewalk.filter.TreeFilter.

Parameters
walker:RevWalk

walker used for reading trees.

t:TreeFilter

filter to compare against any changed paths in each commit. If a org.eclipse.jgit.revwalk.FollowFilter, will be replaced with a new filter following new paths after a rename.

Since
3.5
TreeRevFilterback to summary
pack-priv TreeRevFilter(RevWalk walker, TreeFilter t, int rewriteFlag)

Create a filter for the first phase of a parent-rewriting limited revision walk.

This filter is ANDed to evaluate before all other filters and ties the configured TreeFilter into the revision walking process.

If no interesting tree entries are found the commit is colored with rewriteFlag, allowing a later pass implemented by RewriteGenerator to remove those colored commits from the DAG.

Parameters
walker:RevWalk

walker used for reading trees.

t:TreeFilter

filter to compare against any changed paths in each commit. If a FollowFilter, will be replaced with a new filter following new paths after a rename.

rewriteFlag:int

flag to color commits to be removed from the simplified DAT.

See Also
RewriteGenerator

Method Detail

cloneback to summary
public 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
getChangedPathFilterFalsePositiveback to summary
public long getChangedPathFilterFalsePositive()

Return how many times a changed path filter wrongly predicted that a path was changed in a commit, for statistics gathering purposes.

Returns:long

count of false positives

Since
6.7
getChangedPathFilterNegativeback to summary
public long getChangedPathFilterNegative()

Return how many times a changed path filter predicted that a path was not changed in a commit (allowing that commit to be skipped), for statistics gathering purposes.

Returns:long

count of negatives

Since
6.7
getChangedPathFilterTruePositiveback to summary
public long getChangedPathFilterTruePositive()

Return how many times a changed path filter correctly predicted that a path was changed in a commit, for statistics gathering purposes.

Returns:long

count of true positives

Since
6.7
includeback to summary
public boolean include(RevWalk walker, RevCommit c) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException

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.

c: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
Exceptions
StopWalkException:
the filter knows for certain that no additional commits can ever match, and the current commit doesn't match either. The walk is halted and no more results are provided.
MissingObjectException:
an object the filter needs to consult to determine its answer does not exist in the Git repository the walker is operating on. Filtering this commit is impossible without the object.
IncorrectObjectTypeException:
an object the filter needed to consult was not of the expected object type. This usually indicates a corrupt repository, as an object link is referencing the wrong type.
IOException:
a loose object or pack file could not be read to obtain data necessary for the filter to make its decision.
isRenameback to summary
private static boolean isRename(DiffEntry ent)
requiresCommitBodyback to summary
public 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
updateFollowFilterback to summary
private void updateFollowFilter(ObjectId[] trees, DiffConfig cfg, RevCommit commit) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException