Top Description Constructors Methods
org.eclipse.jgit.revwalk

public final Class RevWalkUtils

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .Collection, .List, org.eclipse.jgit.errors.IncorrectObjectTypeException, .MissingObjectException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.NullProgressMonitor, .ProgressMonitor, .Ref

Utility methods for org.eclipse.jgit.revwalk.RevWalk.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the number of commits
count
(final RevWalk
the rev walk to use
walk
,
final RevCommit
the commit to start counting from
start
,
final RevCommit
the commit where counting should end, or null if counting should be done until there are no more commits
end
)

Count the number of commits that are reachable from start until a commit that is reachable from end is encountered.

public static List<RevCommit>

Returns:

the commits found
find
(final RevWalk
the rev walk to use
walk
,
final RevCommit
the commit to start counting from
start
,
final RevCommit
the commit where counting should end, or null if counting should be done until there are no more commits
end
)

Find commits that are reachable from start until a commit that is reachable from end is encountered.

public static List<Ref>

Returns:

the list of branches a given commit is reachable from
findBranchesReachableFrom
(RevCommit
the commit we are looking at
commit
,
RevWalk
The RevWalk to be used.
revWalk
,
Collection<Ref>
the set of branches we want to see reachability from
refs
)

Find the list of branches a given commit is reachable from when following parents.

public static List<Ref>

Returns:

the list of branches a given commit is reachable from
findBranchesReachableFrom
(RevCommit
the commit we are looking at
commit
,
RevWalk
The RevWalk to be used.
revWalk
,
Collection<Ref>
the set of branches we want to see reachability from
refs
,
ProgressMonitor
the callback for progress and cancellation
monitor
)

Find the list of branches a given commit is reachable from when following parents.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RevWalkUtilsback to summary
private RevWalkUtils()

Method Detail

countback to summary
public static int count(final RevWalk walk, final RevCommit start, final RevCommit end) throws MissingObjectException, IncorrectObjectTypeException, IOException

Count the number of commits that are reachable from start until a commit that is reachable from end is encountered. In other words, count the number of commits that are in start, but not in end.

Note that this method calls org.eclipse.jgit.revwalk.RevWalk#reset() at the beginning. Also note that the existing rev filter on the walk is left as-is, so be sure to set the right rev filter before calling this method.

Parameters
walk:RevWalk

the rev walk to use

start:RevCommit

the commit to start counting from

end:RevCommit

the commit where counting should end, or null if counting should be done until there are no more commits

Returns:int

the number of commits

Exceptions
MissingObjectException:
if object is missing
IncorrectObjectTypeException:
if object has unexpected type
IOException:
if an IO error occurred
findback to summary
public static List<RevCommit> find(final RevWalk walk, final RevCommit start, final RevCommit end) throws MissingObjectException, IncorrectObjectTypeException, IOException

Find commits that are reachable from start until a commit that is reachable from end is encountered. In other words, Find of commits that are in start, but not in end.

Note that this method calls org.eclipse.jgit.revwalk.RevWalk#reset() at the beginning. Also note that the existing rev filter on the walk is left as-is, so be sure to set the right rev filter before calling this method.

Parameters
walk:RevWalk

the rev walk to use

start:RevCommit

the commit to start counting from

end:RevCommit

the commit where counting should end, or null if counting should be done until there are no more commits

Returns:List<RevCommit>

the commits found

Exceptions
MissingObjectException:
if object is missing
IncorrectObjectTypeException:
if object has unexpected type
IOException:
if an IO error occurred
findBranchesReachableFromback to summary
public static List<Ref> findBranchesReachableFrom(RevCommit commit, RevWalk revWalk, Collection<Ref> refs) throws MissingObjectException, IncorrectObjectTypeException, IOException

Find the list of branches a given commit is reachable from when following parents.

Note that this method calls org.eclipse.jgit.revwalk.RevWalk#reset() at the beginning.

In order to improve performance this method assumes clock skew among committers is never larger than 24 hours.

Parameters
commit:RevCommit

the commit we are looking at

revWalk:RevWalk

The RevWalk to be used.

refs:Collection<Ref>

the set of branches we want to see reachability from

Returns:List<Ref>

the list of branches a given commit is reachable from

Exceptions
MissingObjectException:
if object is missing
IncorrectObjectTypeException:
if object has unexpected type
IOException:
if an IO error occurred
findBranchesReachableFromback to summary
public static List<Ref> findBranchesReachableFrom(RevCommit commit, RevWalk revWalk, Collection<Ref> refs, ProgressMonitor monitor) throws MissingObjectException, IncorrectObjectTypeException, IOException

Find the list of branches a given commit is reachable from when following parents.

Note that this method calls org.eclipse.jgit.revwalk.RevWalk#reset() at the beginning.

In order to improve performance this method assumes clock skew among committers is never larger than 24 hours.

Parameters
commit:RevCommit

the commit we are looking at

revWalk:RevWalk

The RevWalk to be used.

refs:Collection<Ref>

the set of branches we want to see reachability from

monitor:ProgressMonitor

the callback for progress and cancellation

Returns:List<Ref>

the list of branches a given commit is reachable from

Exceptions
MissingObjectException:
if object is missing
IncorrectObjectTypeException:
if object has unexpected type
IOException:
if an IO error occurred
Since
5.4