org.eclipse.jgit.errors.StopWalkException Java Examples

The following examples show how to use org.eclipse.jgit.errors.StopWalkException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommitTimeRevFilter.java    From onedev with MIT License 5 votes vote down vote up
@Override
public boolean include(RevWalk walker, RevCommit cmit)
		throws StopWalkException, MissingObjectException,
		IncorrectObjectTypeException, IOException {
	// Since the walker sorts commits by commit time we can be
	// reasonably certain there is nothing remaining worth our
	// scanning if this commit is before the point in question.
	//
	if (cmit.getCommitTime() < when)
		throw StopWalkException.INSTANCE;
	return true;
}
 
Example #2
Source File: MaxCountRevFilter.java    From onedev with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean include(RevWalk walker, RevCommit cmit)
		throws StopWalkException, MissingObjectException,
		IncorrectObjectTypeException, IOException {
	count++;
	if (count > maxCount)
		throw StopWalkException.INSTANCE;
	return true;
}
 
Example #3
Source File: SkipRevFilter.java    From onedev with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean include(RevWalk walker, RevCommit cmit)
		throws StopWalkException, MissingObjectException,
		IncorrectObjectTypeException, IOException {
	if (skip > count++)
		return false;
	return true;
}
 
Example #4
Source File: CancelRevFilter.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean include (RevWalk walker, RevCommit cmit) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException {
    if (monitor.isCanceled()) {
        throw StopWalkException.INSTANCE;
    }
    return true;
}
 
Example #5
Source File: RootCommit.java    From jgitver with Apache License 2.0 5 votes vote down vote up
static RevFilter rootFilter() {
    return new RevFilter() {
        @Override
        public boolean include(RevWalk walker, RevCommit commit) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException {
            return commit.getParents().length == 0;
        }

        @Override
        public RevFilter clone() {
            return rootFilter();
        }
    };
}
 
Example #6
Source File: PendingGenerator.java    From onedev with MIT License 4 votes vote down vote up
@Override
RevCommit next() throws MissingObjectException,
		IncorrectObjectTypeException, IOException {
	try {
		for (;;) {
			final RevCommit c = pending.next();
			if (c == null) {
				return null;
			}

			final boolean produce;
			if ((c.flags & UNINTERESTING) != 0)
				produce = false;
			else {
				if (filter.requiresCommitBody())
					c.parseBody(walker);
				produce = filter.include(walker, c);
			}

			for (int i = 0; i < c.parents.length; i++) {
				RevCommit p = c.parents[i];
				// If the commit is uninteresting, don't try to prune
				// parents because we want the maximal uninteresting set.
				if (firstParent && i > 0 && (c.flags & UNINTERESTING) == 0) {
					continue;
				}
				if ((p.flags & SEEN) != 0)
					continue;
				if ((p.flags & PARSED) == 0)
					p.parseHeaders(walker);
				p.flags |= SEEN;
				pending.add(p);
			}
			walker.carryFlagsImpl(c);

			if ((c.flags & UNINTERESTING) != 0) {
				if (pending.everbodyHasFlag(UNINTERESTING)) {
					final RevCommit n = pending.peek();
					if (n != null && n.commitTime >= last.commitTime) {
						// This is too close to call. The next commit we
						// would pop is dated after the last one produced.
						// We have to keep going to ensure that we carry
						// flags as much as necessary.
						//
						overScan = OVER_SCAN;
					} else if (--overScan == 0)
						throw StopWalkException.INSTANCE;
				} else {
					overScan = OVER_SCAN;
				}
				if (canDispose)
					c.disposeBody();
				continue;
			}

			if (produce)
				return last = c;
			else if (canDispose)
				c.disposeBody();
		}
	} catch (StopWalkException swe) {
		pending.clear();
		return null;
	}
}
 
Example #7
Source File: CommitTimeRevFilter.java    From onedev with MIT License 4 votes vote down vote up
@Override
public boolean include(RevWalk walker, RevCommit cmit)
		throws StopWalkException, MissingObjectException,
		IncorrectObjectTypeException, IOException {
	return cmit.getCommitTime() <= when;
}
 
Example #8
Source File: CommitTimeRevFilter.java    From onedev with MIT License 4 votes vote down vote up
@Override
public boolean include(RevWalk walker, RevCommit cmit)
		throws StopWalkException, MissingObjectException,
		IncorrectObjectTypeException, IOException {
	return cmit.getCommitTime() <= until && cmit.getCommitTime() >= when;
}
 
Example #9
Source File: SHA1RevFilter.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean include(RevWalk walker, RevCommit cmit) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException {
	return cmit.getName().contains(sha1);
}
 
Example #10
Source File: RevFilter.java    From onedev with MIT License 2 votes vote down vote up
/**
 * Determine if the supplied commit should be included in results.
 *
 * @param walker
 *            the active walker this filter is being invoked from within.
 * @param cmit
 *            the commit currently being tested. The commit has been parsed
 *            and its body is available for inspection only if the filter
 *            returns true from {@link #requiresCommitBody()}.
 * @return true to include this commit in the results; false to have this
 *         commit be omitted entirely from the results.
 * @throws org.eclipse.jgit.errors.StopWalkException
 *             the filter knows for certain that no additional commits can
 *             ever match, and the current commit doesn't match either. The
 *             walk is halted and no more results are provided.
 * @throws org.eclipse.jgit.errors.MissingObjectException
 *             an object the filter needs to consult to determine its answer
 *             does not exist in the Git repository the walker is operating
 *             on. Filtering this commit is impossible without the object.
 * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
 *             an object the filter needed to consult was not of the
 *             expected object type. This usually indicates a corrupt
 *             repository, as an object link is referencing the wrong type.
 * @throws java.io.IOException
 *             a loose object or pack file could not be read to obtain data
 *             necessary for the filter to make its decision.
 */
public abstract boolean include(RevWalk walker, RevCommit cmit)
		throws StopWalkException, MissingObjectException,
		IncorrectObjectTypeException, IOException;