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.REWRITEcolored 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 intDUPLICATEForcleanup(RevCommit[])to remove duplicate parents.private static intREWRITEprivate Generatorsource-
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) RevCommitnext()Return the next commit to the application, or the next generator.(package private) intoutputType()Obtain flags describing the output behavior of this generator.private RevCommitrewrite(RevCommit p)(package private) voidshareFreeList(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:GeneratorConnect the supplied queue to this generator's own free list (if any).- Overrides:
shareFreeListin classGenerator- Parameters:
q- another FIFO queue that wants to share our queue's free list.
-
outputType
int outputType()
Description copied from class:GeneratorObtain flags describing the output behavior of this generator.- Specified by:
outputTypein 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:GeneratorReturn the next commit to the application, or the next generator.- Specified by:
nextin classGenerator- Returns:
- next available commit; null if no more are to be returned.
- Throws:
MissingObjectExceptionIncorrectObjectTypeExceptionjava.io.IOException
-
-