Example usage for org.eclipse.jgit.revwalk RevWalk resetRetain

List of usage examples for org.eclipse.jgit.revwalk RevWalk resetRetain

Introduction

In this page you can find the example usage for org.eclipse.jgit.revwalk RevWalk resetRetain.

Prototype

public final void resetRetain(RevFlag... retainFlags) 

Source Link

Document

Resets internal state and allows this instance to be used again.

Usage

From source file:com.google.gerrit.server.git.MergeUtil.java

License:Apache License

public void markCleanMerges(final RevWalk rw, final RevFlag canMergeFlag, final CodeReviewCommit mergeTip,
        final Set<RevCommit> alreadyAccepted) throws MergeException {
    if (mergeTip == null) {
        // If mergeTip is null here, branchTip was null, indicating a new branch
        // at the start of the merge process. We also elected to merge nothing,
        // probably due to missing dependencies. Nothing was cleanly merged.
        ///*from   w w  w. j  a  va 2s .  c  om*/
        return;
    }

    try {
        rw.resetRetain(canMergeFlag);
        rw.sort(RevSort.TOPO);
        rw.sort(RevSort.REVERSE, true);
        rw.markStart(mergeTip);
        for (RevCommit c : alreadyAccepted) {
            rw.markUninteresting(c);
        }

        CodeReviewCommit c;
        while ((c = (CodeReviewCommit) rw.next()) != null) {
            if (c.getPatchsetId() != null) {
                c.setStatusCode(CommitMergeStatus.CLEAN_MERGE);
            }
        }
    } catch (IOException e) {
        throw new MergeException("Cannot mark clean merges", e);
    }
}