Class RewriteGenerator
- java.lang.Object
-
- org.eclipse.jgit.revwalk.Generator
-
- org.eclipse.jgit.revwalk.RewriteGenerator
-
class RewriteGenerator extends Generator
Replaces a RevCommit's parents until not colored with REWRITE.Before a RevCommit is returned to the caller its parents are updated to create a dense DAG. Instead of reporting the actual parents as recorded when the commit was created the returned commit will reflect the next closest commit that matched the revision walker's filters.
This generator is the second phase of a path limited revision walk and assumes it is receiving RevCommits from
TreeRevFilter
, after they have been fully buffered byAbstractRevQueue
. The full buffering is necessary to allow the simple loop used within our ownrewrite(RevCommit)
to pull completely through a strand ofRevWalk.REWRITE
colored commits and come up with a simplification that makes the DAG dense. Not fully buffering the commits first would cause this loop to abort early, due to commits not being parsed and colored correctly.- See Also:
TreeRevFilter
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DUPLICATE
Forcleanup(RevCommit[])
to remove duplicate parents.private static int
REWRITE
private Generator
source
-
Fields inherited from class org.eclipse.jgit.revwalk.Generator
firstParent, HAS_REWRITE, HAS_UNINTERESTING, NEEDS_REWRITE, SORT_COMMIT_TIME_DESC, SORT_TOPO
-
-
Constructor Summary
Constructors Constructor Description RewriteGenerator(Generator s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private RevCommit[]
cleanup(RevCommit[] oldList)
(package private) RevCommit
next()
Return the next commit to the application, or the next generator.(package private) int
outputType()
Obtain flags describing the output behavior of this generator.private RevCommit
rewrite(RevCommit p)
(package private) void
shareFreeList(BlockRevQueue q)
Connect the supplied queue to this generator's own free list (if any).
-
-
-
Field Detail
-
REWRITE
private static final int REWRITE
- See Also:
- Constant Field Values
-
DUPLICATE
private static final int DUPLICATE
Forcleanup(RevCommit[])
to remove duplicate parents.- See Also:
- Constant Field Values
-
source
private final Generator source
-
-
Constructor Detail
-
RewriteGenerator
RewriteGenerator(Generator s)
-
-
Method Detail
-
shareFreeList
void shareFreeList(BlockRevQueue q)
Description copied from class:Generator
Connect the supplied queue to this generator's own free list (if any).- Overrides:
shareFreeList
in classGenerator
- Parameters:
q
- another FIFO queue that wants to share our queue's free list.
-
outputType
int outputType()
Description copied from class:Generator
Obtain flags describing the output behavior of this generator.- Specified by:
outputType
in classGenerator
- Returns:
- one or more of the constants declared in this class, describing how this generator produces its results.
-
next
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, java.io.IOException
Description copied from class:Generator
Return the next commit to the application, or the next generator.- Specified by:
next
in classGenerator
- Returns:
- next available commit; null if no more are to be returned.
- Throws:
MissingObjectException
IncorrectObjectTypeException
java.io.IOException
-
-