Package org.eclipse.jgit.revwalk
Class RevWalkUtils
- java.lang.Object
-
- org.eclipse.jgit.revwalk.RevWalkUtils
-
public final class RevWalkUtils extends java.lang.Object
Utility methods forRevWalk
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
count(RevWalk walk, RevCommit start, RevCommit end)
Count the number of commits that are reachable fromstart
until a commit that is reachable fromend
is encountered.static java.util.List<RevCommit>
find(RevWalk walk, RevCommit start, RevCommit end)
Find commits that are reachable fromstart
until a commit that is reachable fromend
is encountered.static java.util.List<Ref>
findBranchesReachableFrom(RevCommit commit, RevWalk revWalk, java.util.Collection<Ref> refs)
Find the list of branches a given commit is reachable from when following parent.s
-
-
-
Method Detail
-
count
public static int count(RevWalk walk, RevCommit start, RevCommit end) throws MissingObjectException, IncorrectObjectTypeException, java.io.IOException
Count the number of commits that are reachable fromstart
until a commit that is reachable fromend
is encountered. In other words, count the number of commits that are instart
, but not inend
.Note that this method calls
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
- the rev walk to usestart
- the commit to start counting fromend
- the commit where counting should end, or null if counting should be done until there are no more commits- Returns:
- the number of commits
- Throws:
MissingObjectException
IncorrectObjectTypeException
java.io.IOException
-
find
public static java.util.List<RevCommit> find(RevWalk walk, RevCommit start, RevCommit end) throws MissingObjectException, IncorrectObjectTypeException, java.io.IOException
Find commits that are reachable fromstart
until a commit that is reachable fromend
is encountered. In other words, Find of commits that are instart
, but not inend
.Note that this method calls
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
- the rev walk to usestart
- the commit to start counting fromend
- the commit where counting should end, or null if counting should be done until there are no more commits- Returns:
- the commits found
- Throws:
MissingObjectException
IncorrectObjectTypeException
java.io.IOException
-
findBranchesReachableFrom
public static java.util.List<Ref> findBranchesReachableFrom(RevCommit commit, RevWalk revWalk, java.util.Collection<Ref> refs) throws MissingObjectException, IncorrectObjectTypeException, java.io.IOException
Find the list of branches a given commit is reachable from when following parent.sNote that this method calls
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
- the commit we are looking atrevWalk
- The RevWalk to be used.refs
- the set of branches we want to see reachability from- Returns:
- the list of branches a given commit is reachable from
- Throws:
MissingObjectException
IncorrectObjectTypeException
java.io.IOException
-
-