Fix javadoc in org.eclipse.jgit revwalk package

Change-Id: I3fabab8afa284b1919ab7bc656cab19e56ed474e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2017-12-19 00:01:55 +01:00
parent 23f3b6ab24
commit 0cba440277
40 changed files with 487 additions and 256 deletions

View File

@ -103,14 +103,16 @@ public final void addParents(final RevCommit c, final RevFlag queueControl) {
}
/**
* {@inheritDoc}
* <p>
* Remove the first commit from the queue.
*
* @return the first commit of this queue.
*/
@Override
public abstract RevCommit next();
/** Remove all entries from this queue. */
/**
* Remove all entries from this queue.
*/
public abstract void clear();
abstract boolean everbodyHasFlag(int f);
@ -122,6 +124,14 @@ int outputType() {
return outputType;
}
/**
* Describe this queue
*
* @param s
* a StringBuilder
* @param c
* a {@link org.eclipse.jgit.revwalk.RevCommit}
*/
protected static void describe(final StringBuilder s, final RevCommit c) {
s.append(c.toString());
s.append('\n');

View File

@ -59,11 +59,11 @@ public interface AsyncRevObjectQueue extends AsyncOperation {
* Obtain the next object.
*
* @return the object; null if there are no more objects remaining.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the object does not exist. There may be more objects
* remaining in the iteration, the application should call
* {@link #next()} again.
* @throws IOException
* @throws java.io.IOException
* the object store cannot be accessed.
*/
public RevObject next() throws MissingObjectException, IOException;

View File

@ -102,21 +102,27 @@ public long getCountOfBitmapIndexMisses() {
/**
* Return, as a bitmap, the objects reachable from the objects in start.
*
* @param start the objects to start the object traversal from.
* @param seen the objects to skip if encountered during traversal.
* @param ignoreMissing true to ignore missing objects, false otherwise.
* @param start
* the objects to start the object traversal from.
* @param seen
* the objects to skip if encountered during traversal.
* @param ignoreMissing
* true to ignore missing objects, false otherwise.
* @return as a bitmap, the objects reachable from the objects in start.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the object supplied is not available from the object
* database. This usually indicates the supplied object is
* invalid, but the reference was constructed during an earlier
* invocation to {@link RevWalk#lookupAny(AnyObjectId, int)}.
* @throws IncorrectObjectTypeException
* invocation to
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}.
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the object was not parsed yet and it was discovered during
* parsing that it is not actually the type of the instance
* passed in. This usually indicates the caller used the wrong
* type in a {@link RevWalk#lookupAny(AnyObjectId, int)} call.
* @throws IOException
* type in a
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}
* call.
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public BitmapBuilder findObjects(Iterable<? extends ObjectId> start, BitmapBuilder seen,

View File

@ -51,7 +51,9 @@
abstract class BlockRevQueue extends AbstractRevQueue {
protected BlockFreeList free;
/** Create an empty revision queue. */
/**
* Create an empty revision queue.
*/
protected BlockRevQueue() {
free = new BlockFreeList();
}
@ -70,6 +72,8 @@ protected BlockRevQueue() {
}
/**
* {@inheritDoc}
* <p>
* Reconfigure this queue to share the same free list as another.
* <p>
* Multiple revision queues can be connected to the same free list, making
@ -79,9 +83,6 @@ protected BlockRevQueue() {
* <p>
* Free lists are not thread-safe. Applications must ensure that all queues
* sharing the same free list are doing so from only a single thread.
*
* @param q
* the other queue we will steal entries from.
*/
@Override
public void shareFreeList(final BlockRevQueue q) {

View File

@ -49,7 +49,9 @@
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
/** A queue of commits sorted by commit time order. */
/**
* A queue of commits sorted by commit time order.
*/
public class DateRevQueue extends AbstractRevQueue {
private static final int REBUILD_INDEX_COUNT = 1000;
@ -67,7 +69,9 @@ public class DateRevQueue extends AbstractRevQueue {
private int last = -1;
/** Create an empty date queue. */
/**
* Create an empty date queue.
*/
public DateRevQueue() {
super();
}
@ -82,6 +86,7 @@ public DateRevQueue() {
}
}
/** {@inheritDoc} */
@Override
public void add(final RevCommit c) {
sinceLastIndex++;
@ -127,6 +132,7 @@ else if (t > when)
}
}
/** {@inheritDoc} */
@Override
public RevCommit next() {
final Entry q = head;
@ -163,6 +169,7 @@ public RevCommit peek() {
return head != null ? head.commit : null;
}
/** {@inheritDoc} */
@Override
public void clear() {
head = null;
@ -196,6 +203,7 @@ int outputType() {
return outputType | SORT_COMMIT_TIME_DESC;
}
/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder s = new StringBuilder();

View File

@ -52,15 +52,30 @@
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.Repository;
/** Interface for revision walkers that perform depth filtering. */
/**
* Interface for revision walkers that perform depth filtering.
*/
public interface DepthWalk {
/** @return Depth to filter to. */
/**
* Get depth to filter to.
*
* @return Depth to filter to.
*/
public int getDepth();
/** @return flag marking commits that should become unshallow. */
/**
* Get flag marking commits that should become unshallow.
*
* @return flag marking commits that should become unshallow.
*/
public RevFlag getUnshallowFlag();
/** @return flag marking commits that are interesting again. */
/**
* Get flag marking commits that are interesting again.
*
* @return flag marking commits that are interesting again.
*/
public RevFlag getReinterestingFlag();
/** RevCommit with a depth (in commits) from a root. */

View File

@ -48,13 +48,17 @@
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
/** A queue of commits in FIFO order. */
/**
* A queue of commits in FIFO order.
*/
public class FIFORevQueue extends BlockRevQueue {
private Block head;
private Block tail;
/** Create an empty FIFO queue. */
/**
* Create an empty FIFO queue.
*/
public FIFORevQueue() {
super();
}
@ -64,6 +68,7 @@ public FIFORevQueue() {
super(s);
}
/** {@inheritDoc} */
@Override
public void add(final RevCommit c) {
Block b = tail;
@ -108,6 +113,7 @@ public void unpop(final RevCommit c) {
head = b;
}
/** {@inheritDoc} */
@Override
public RevCommit next() {
final Block b = head;
@ -124,6 +130,7 @@ public RevCommit next() {
return c;
}
/** {@inheritDoc} */
@Override
public void clear() {
head = null;
@ -159,6 +166,7 @@ void removeFlag(final int f) {
}
}
/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder s = new StringBuilder();

View File

@ -59,7 +59,8 @@
* triggers rename detection so that the path node is updated to include a prior
* file name as the RevWalk traverses history.
*
* The renames found will be reported to a {@link RenameCallback} if one is set.
* The renames found will be reported to a
* {@link org.eclipse.jgit.revwalk.RenameCallback} if one is set.
* <p>
* Results with this filter are unpredictable if the path being followed is a
* subdirectory.
@ -81,7 +82,7 @@ public class FollowFilter extends TreeFilter {
* @param cfg
* diff config specifying rename detection options.
* @return a new filter for the requested path.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* the path supplied was the empty string.
* @since 3.0
*/
@ -100,10 +101,16 @@ public static FollowFilter create(String path, DiffConfig cfg) {
}
/** @return the path this filter matches. */
/**
* Get the path this filter matches.
*
* @return the path this filter matches.
*/
public String getPath() {
return path.getPath();
}
/** {@inheritDoc} */
@Override
public boolean include(final TreeWalk walker)
throws MissingObjectException, IncorrectObjectTypeException,
@ -111,16 +118,19 @@ public boolean include(final TreeWalk walker)
return path.include(walker) && ANY_DIFF.include(walker);
}
/** {@inheritDoc} */
@Override
public boolean shouldBeRecursive() {
return path.shouldBeRecursive() || ANY_DIFF.shouldBeRecursive();
}
/** {@inheritDoc} */
@Override
public TreeFilter clone() {
return new FollowFilter(path.clone(), cfg);
}
/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {
@ -130,6 +140,8 @@ public String toString() {
}
/**
* Get the callback to which renames are reported.
*
* @return the callback to which renames are reported, or <code>null</code>
* if none
*/

View File

@ -47,7 +47,9 @@
import org.eclipse.jgit.lib.Constants;
/** Case insensitive key for a {@link FooterLine}. */
/**
* Case insensitive key for a {@link org.eclipse.jgit.revwalk.FooterLine}.
*/
public final class FooterKey {
/** Standard {@code Signed-off-by} */
public static final FooterKey SIGNED_OFF_BY = new FooterKey("Signed-off-by"); //$NON-NLS-1$
@ -73,11 +75,16 @@ public FooterKey(final String keyName) {
raw = Constants.encode(keyName.toLowerCase(Locale.ROOT));
}
/** @return name of this footer line. */
/**
* Get name of this footer line.
*
* @return name of this footer line.
*/
public String getName() {
return name;
}
/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

View File

@ -80,6 +80,8 @@ public final class FooterLine {
}
/**
* Whether keys match
*
* @param key
* key to test this line's key name against.
* @return true if {@code key.getName().equalsIgnorecase(getKey())}.
@ -101,6 +103,8 @@ public boolean matches(final FooterKey key) {
}
/**
* Get key name of this footer.
*
* @return key name of this footer; that is the text before the ":" on the
* line footer's line. The text is decoded according to the commit's
* specified (or assumed) character encoding.
@ -110,6 +114,8 @@ public String getKey() {
}
/**
* Get value of this footer.
*
* @return value of this footer; that is the text after the ":" and any
* leading whitespace has been skipped. May be the empty string if
* the footer has no value (line ended with ":"). The text is
@ -144,6 +150,7 @@ public String getEmailAddress() {
return RawParseUtils.decode(enc, buffer, lt, gt - 1);
}
/** {@inheritDoc} */
@Override
public String toString() {
return getKey() + ": " + getValue(); //$NON-NLS-1$

View File

@ -49,11 +49,15 @@
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
/** A queue of commits in LIFO order. */
/**
* A queue of commits in LIFO order.
*/
public class LIFORevQueue extends BlockRevQueue {
private Block head;
/** Create an empty LIFO queue. */
/**
* Create an empty LIFO queue.
*/
public LIFORevQueue() {
super();
}
@ -63,6 +67,7 @@ public LIFORevQueue() {
super(s);
}
/** {@inheritDoc} */
@Override
public void add(final RevCommit c) {
Block b = head;
@ -75,6 +80,7 @@ public void add(final RevCommit c) {
b.unpop(c);
}
/** {@inheritDoc} */
@Override
public RevCommit next() {
final Block b = head;
@ -89,6 +95,7 @@ public RevCommit next() {
return c;
}
/** {@inheritDoc} */
@Override
public void clear() {
head = null;
@ -115,6 +122,7 @@ boolean anybodyHasFlag(final int f) {
return false;
}
/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder s = new StringBuilder();

View File

@ -76,8 +76,9 @@
* scheduled for inclusion in the results of {@link #nextObject()}, returning
* each object exactly once. Objects are sorted and returned according to the
* the commits that reference them and the order they appear within a tree.
* Ordering can be affected by changing the {@link RevSort} used to order the
* commits that are returned first.
* Ordering can be affected by changing the
* {@link org.eclipse.jgit.revwalk.RevSort} used to order the commits that are
* returned first.
*/
public class ObjectWalk extends RevWalk {
private static final int ID_SZ = 20;
@ -142,34 +143,39 @@ public ObjectWalk(ObjectReader or) {
/**
* Mark an object or commit to start graph traversal from.
* <p>
* Callers are encouraged to use {@link RevWalk#parseAny(AnyObjectId)}
* instead of {@link RevWalk#lookupAny(AnyObjectId, int)}, as this method
* requires the object to be parsed before it can be added as a root for the
* traversal.
* Callers are encouraged to use
* {@link org.eclipse.jgit.revwalk.RevWalk#parseAny(AnyObjectId)} instead of
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}, as
* this method requires the object to be parsed before it can be added as a
* root for the traversal.
* <p>
* The method will automatically parse an unparsed object, but error
* handling may be more difficult for the application to explain why a
* RevObject is not actually valid. The object pool of this walker would
* also be 'poisoned' by the invalid RevObject.
* <p>
* This method will automatically call {@link RevWalk#markStart(RevCommit)}
* if passed RevCommit instance, or a RevTag that directly (or indirectly)
* references a RevCommit.
* This method will automatically call
* {@link org.eclipse.jgit.revwalk.RevWalk#markStart(RevCommit)} if passed
* RevCommit instance, or a RevTag that directly (or indirectly) references
* a RevCommit.
*
* @param o
* the object to start traversing from. The object passed must be
* from this same revision walker.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the object supplied is not available from the object
* database. This usually indicates the supplied object is
* invalid, but the reference was constructed during an earlier
* invocation to {@link RevWalk#lookupAny(AnyObjectId, int)}.
* @throws IncorrectObjectTypeException
* invocation to
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}.
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the object was not parsed yet and it was discovered during
* parsing that it is not actually the type of the instance
* passed in. This usually indicates the caller used the wrong
* type in a {@link RevWalk#lookupAny(AnyObjectId, int)} call.
* @throws IOException
* type in a
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}
* call.
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void markStart(RevObject o) throws MissingObjectException,
@ -193,33 +199,38 @@ public void markStart(RevObject o) throws MissingObjectException,
* reachable chain, back until the merge base of an uninteresting commit and
* an otherwise interesting commit.
* <p>
* Callers are encouraged to use {@link RevWalk#parseAny(AnyObjectId)}
* instead of {@link RevWalk#lookupAny(AnyObjectId, int)}, as this method
* requires the object to be parsed before it can be added as a root for the
* traversal.
* Callers are encouraged to use
* {@link org.eclipse.jgit.revwalk.RevWalk#parseAny(AnyObjectId)} instead of
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}, as
* this method requires the object to be parsed before it can be added as a
* root for the traversal.
* <p>
* The method will automatically parse an unparsed object, but error
* handling may be more difficult for the application to explain why a
* RevObject is not actually valid. The object pool of this walker would
* also be 'poisoned' by the invalid RevObject.
* <p>
* This method will automatically call {@link RevWalk#markStart(RevCommit)}
* if passed RevCommit instance, or a RevTag that directly (or indirectly)
* references a RevCommit.
* This method will automatically call
* {@link org.eclipse.jgit.revwalk.RevWalk#markStart(RevCommit)} if passed
* RevCommit instance, or a RevTag that directly (or indirectly) references
* a RevCommit.
*
* @param o
* the object to start traversing from. The object passed must be
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the object supplied is not available from the object
* database. This usually indicates the supplied object is
* invalid, but the reference was constructed during an earlier
* invocation to {@link RevWalk#lookupAny(AnyObjectId, int)}.
* @throws IncorrectObjectTypeException
* invocation to
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}.
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the object was not parsed yet and it was discovered during
* parsing that it is not actually the type of the instance
* passed in. This usually indicates the caller used the wrong
* type in a {@link RevWalk#lookupAny(AnyObjectId, int)} call.
* @throws IOException
* type in a
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}
* call.
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void markUninteresting(RevObject o) throws MissingObjectException,
@ -243,12 +254,14 @@ else if (o instanceof RevTree)
addObject(o);
}
/** {@inheritDoc} */
@Override
public void sort(RevSort s) {
super.sort(s);
boundary = hasRevSort(RevSort.BOUNDARY);
}
/** {@inheritDoc} */
@Override
public void sort(RevSort s, boolean use) {
super.sort(s, use);
@ -259,7 +272,6 @@ public void sort(RevSort s, boolean use) {
* Get the currently configured object filter.
*
* @return the current filter. Never null as a filter is always needed.
*
* @since 4.0
*/
public ObjectFilter getObjectFilter() {
@ -267,9 +279,9 @@ public ObjectFilter getObjectFilter() {
}
/**
* Set the object filter for this walker. This filter affects the objects
* visited by {@link #nextObject()}. It does not affect the commits
* listed by {@link #next()}.
* Set the object filter for this walker. This filter affects the objects
* visited by {@link #nextObject()}. It does not affect the commits listed
* by {@link #next()}.
* <p>
* If the filter returns false for an object, then that object is skipped
* and objects reachable from it are not enqueued to be walked recursively.
@ -277,9 +289,9 @@ public ObjectFilter getObjectFilter() {
* are known to be uninteresting.
*
* @param newFilter
* the new filter. If null the special {@link ObjectFilter#ALL}
* the new filter. If null the special
* {@link org.eclipse.jgit.revwalk.filter.ObjectFilter#ALL}
* filter will be used instead, as it matches every object.
*
* @since 4.0
*/
public void setObjectFilter(ObjectFilter newFilter) {
@ -287,6 +299,7 @@ public void setObjectFilter(ObjectFilter newFilter) {
objectFilter = newFilter != null ? newFilter : ObjectFilter.ALL;
}
/** {@inheritDoc} */
@Override
public RevCommit next() throws MissingObjectException,
IncorrectObjectTypeException, IOException {
@ -316,14 +329,14 @@ public RevCommit next() throws MissingObjectException,
* Pop the next most recent object.
*
* @return next most recent object; null if traversal is over.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* one or or more of the next objects are not available from the
* object database, but were thought to be candidates for
* traversal. This usually indicates a broken link.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* one or or more of the objects in a tree do not match the type
* indicated.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevObject nextObject() throws MissingObjectException,
@ -520,14 +533,14 @@ private static int parseMode(byte[] buf, int startPtr, int recEndPtr, TreeVisit
* exception if there is a connectivity problem. The exception message
* provides some detail about the connectivity failure.
*
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* one or or more of the next objects are not available from the
* object database, but were thought to be candidates for
* traversal. This usually indicates a broken link.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* one or or more of the objects in a tree do not match the type
* indicated.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void checkConnectivity() throws MissingObjectException,
@ -618,14 +631,22 @@ public int getPathHashCode() {
return hash;
}
/** @return the internal buffer holding the current path. */
/**
* Get the internal buffer holding the current path.
*
* @return the internal buffer holding the current path.
*/
public byte[] getPathBuffer() {
if (pathLen == 0)
pathLen = updatePathBuf(currVisit);
return pathBuf;
}
/** @return length of the path in {@link #getPathBuffer()}. */
/**
* Get length of the path in {@link #getPathBuffer()}.
*
* @return length of the path in {@link #getPathBuffer()}.
*/
public int getPathLength() {
if (pathLen == 0)
pathLen = updatePathBuf(currVisit);
@ -667,6 +688,7 @@ private void growPathBuf(int ptr) {
pathBuf = newBuf;
}
/** {@inheritDoc} */
@Override
public void dispose() {
super.dispose();
@ -675,6 +697,7 @@ public void dispose() {
freeVisit = null;
}
/** {@inheritDoc} */
@Override
protected void reset(final int retainFlags) {
super.reset(retainFlags);

View File

@ -46,8 +46,9 @@
/**
* An instance of this class can be used in conjunction with a
* {@link FollowFilter}. Whenever a rename has been detected during a revision
* walk, it will be reported here.
* {@link org.eclipse.jgit.revwalk.FollowFilter}. Whenever a rename has been
* detected during a revision walk, it will be reported here.
*
* @see FollowFilter#setRenameCallback(RenameCallback)
*/
public abstract class RenameCallback {

View File

@ -52,7 +52,9 @@
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
/** A binary file, or a symbolic link. */
/**
* A binary file, or a symbolic link.
*/
public class RevBlob extends RevObject {
/**
* Create a new blob reference.
@ -64,6 +66,7 @@ protected RevBlob(final AnyObjectId id) {
super(id);
}
/** {@inheritDoc} */
@Override
public final int getType() {
return Constants.OBJ_BLOB;

View File

@ -66,7 +66,9 @@
import org.eclipse.jgit.util.RawParseUtils;
import org.eclipse.jgit.util.StringUtils;
/** A commit reference to a commit in the DAG. */
/**
* A commit reference to a commit in the DAG.
*/
public class RevCommit extends RevObject {
private static final int STACK_DEPTH = 500;
@ -79,7 +81,8 @@ public class RevCommit extends RevObject {
* will not have their headers loaded.
*
* Applications are discouraged from using this API. Callers usually need
* more than one commit. Use {@link RevWalk#parseCommit(AnyObjectId)} to
* more than one commit. Use
* {@link org.eclipse.jgit.revwalk.RevWalk#parseCommit(AnyObjectId)} to
* obtain a RevCommit from an existing repository.
*
* @param raw
@ -115,7 +118,7 @@ public static RevCommit parse(byte[] raw) {
* modified by the caller.
* @return the parsed commit, in an isolated revision pool that is not
* available to the caller.
* @throws IOException
* @throws java.io.IOException
* in case of RevWalk initialization fails
*/
public static RevCommit parse(RevWalk rw, byte[] raw) throws IOException {
@ -220,6 +223,7 @@ else if (nParents == 1) {
flags |= PARSED;
}
/** {@inheritDoc} */
@Override
public final int getType() {
return Constants.OBJ_COMMIT;
@ -315,7 +319,7 @@ public void carry(final RevFlag flag) {
/**
* Time from the "committer " line of the buffer.
*
* @return time, expressed as seconds since the epoch.
* @return commit time
*/
public final int getCommitTime() {
return commitTime;
@ -346,7 +350,7 @@ public final int getParentCount() {
* parent index to obtain. Must be in the range 0 through
* {@link #getParentCount()}-1.
* @return the specified parent.
* @throws ArrayIndexOutOfBoundsException
* @throws java.lang.ArrayIndexOutOfBoundsException
* an invalid parent index was specified.
*/
public final RevCommit getParent(final int nth) {
@ -394,9 +398,10 @@ public final byte[] getRawBuffer() {
* should cache the return value for as long as necessary to use all
* information from it.
* <p>
* RevFilter implementations should try to use {@link RawParseUtils} to scan
* the {@link #getRawBuffer()} instead, as this will allow faster evaluation
* of commits.
* RevFilter implementations should try to use
* {@link org.eclipse.jgit.util.RawParseUtils} to scan the
* {@link #getRawBuffer()} instead, as this will allow faster evaluation of
* commits.
*
* @return identity of the author (name, email) and the time the commit was
* made by the author; null if no author line was found.
@ -420,9 +425,10 @@ public final PersonIdent getAuthorIdent() {
* should cache the return value for as long as necessary to use all
* information from it.
* <p>
* RevFilter implementations should try to use {@link RawParseUtils} to scan
* the {@link #getRawBuffer()} instead, as this will allow faster evaluation
* of commits.
* RevFilter implementations should try to use
* {@link org.eclipse.jgit.util.RawParseUtils} to scan the
* {@link #getRawBuffer()} instead, as this will allow faster evaluation of
* commits.
*
* @return identity of the committer (name, email) and the time the commit
* was made by the committer; null if no committer line was found.
@ -654,7 +660,7 @@ public void reset() {
* time in {@link #getCommitTime()}. Accessing other properties such as
* {@link #getAuthorIdent()}, {@link #getCommitterIdent()} or either message
* function requires reloading the buffer by invoking
* {@link RevWalk#parseBody(RevObject)}.
* {@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.
*
* @since 4.0
*/
@ -662,6 +668,7 @@ public final void disposeBody() {
buffer = null;
}
/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder s = new StringBuilder();

View File

@ -50,7 +50,7 @@
import org.eclipse.jgit.revwalk.filter.RevFilter;
/**
* An ordered list of {@link RevCommit} subclasses.
* An ordered list of {@link org.eclipse.jgit.revwalk.RevCommit} subclasses.
*
* @param <E>
* type of subclass of RevCommit the list is storing.
@ -58,6 +58,7 @@
public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {
private RevWalk walker;
/** {@inheritDoc} */
@Override
public void clear() {
super.clear();
@ -77,15 +78,15 @@ public void clear() {
* @param flag
* the flag to apply (or remove). Applications are responsible
* for allocating this flag from the source RevWalk.
* @throws IOException
* @throws java.io.IOException
* revision filter needed to read additional objects, but an
* error occurred while reading the pack files or loose objects
* of the repository.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* revision filter needed to read additional objects, but an
* object was not of the correct type. Repository corruption may
* have occurred.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* revision filter needed to read additional objects, but an
* object that should be present was not found. Repository
* corruption may have occurred.
@ -117,15 +118,15 @@ public void applyFlag(final RevFilter matching, final RevFlag flag)
* last commit within the list to end testing at, exclusive. If
* smaller than or equal to <code>rangeBegin</code> then no
* commits will be tested.
* @throws IOException
* @throws java.io.IOException
* revision filter needed to read additional objects, but an
* error occurred while reading the pack files or loose objects
* of the repository.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* revision filter needed to read additional objects, but an
* object was not of the correct type. Repository corruption may
* have occurred.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* revision filter needed to read additional objects, but an
* object that should be present was not found. Repository
* corruption may have occurred.
@ -290,12 +291,12 @@ public boolean isPending() {
* @param highMark
* number of commits the caller wants this list to contain when
* the fill operation is complete.
* @throws IOException
* see {@link RevWalk#next()}
* @throws IncorrectObjectTypeException
* see {@link RevWalk#next()}
* @throws MissingObjectException
* see {@link RevWalk#next()}
* @throws java.io.IOException
* see {@link org.eclipse.jgit.revwalk.RevWalk#next()}
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* see {@link org.eclipse.jgit.revwalk.RevWalk#next()}
* @throws org.eclipse.jgit.errors.MissingObjectException
* see {@link org.eclipse.jgit.revwalk.RevWalk#next()}
*/
@SuppressWarnings("unchecked")
public void fillTo(final int highMark) throws MissingObjectException,
@ -355,12 +356,12 @@ public void fillTo(final int highMark) throws MissingObjectException,
* contain when the fill operation is complete. If highMark is 0
* the walk is pumped until the specified commit or the end of
* the walk is reached.
* @throws IOException
* see {@link RevWalk#next()}
* @throws IncorrectObjectTypeException
* see {@link RevWalk#next()}
* @throws MissingObjectException
* see {@link RevWalk#next()}
* @throws java.io.IOException
* see {@link org.eclipse.jgit.revwalk.RevWalk#next()}
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* see {@link org.eclipse.jgit.revwalk.RevWalk#next()}
* @throws org.eclipse.jgit.errors.MissingObjectException
* see {@link org.eclipse.jgit.revwalk.RevWalk#next()}
*/
@SuppressWarnings("unchecked")
public void fillTo(final RevCommit commitToLoad, int highMark)

View File

@ -48,9 +48,10 @@
import org.eclipse.jgit.internal.JGitText;
/**
* Application level mark bit for {@link RevObject}s.
* Application level mark bit for {@link org.eclipse.jgit.revwalk.RevObject}s.
* <p>
* To create a flag use {@link RevWalk#newFlag(String)}.
* To create a flag use
* {@link org.eclipse.jgit.revwalk.RevWalk#newFlag(String)}.
*/
public class RevFlag {
/**
@ -99,6 +100,7 @@ public RevWalk getRevWalk() {
return walker;
}
/** {@inheritDoc} */
@Override
public String toString() {
return name;

View File

@ -50,7 +50,8 @@
import java.util.List;
/**
* Multiple application level mark bits for {@link RevObject}s.
* Multiple application level mark bits for
* {@link org.eclipse.jgit.revwalk.RevObject}s.
*
* @see RevFlag
*/
@ -59,7 +60,9 @@ public class RevFlagSet extends AbstractSet<RevFlag> {
private final List<RevFlag> active;
/** Create an empty set of flags. */
/**
* Create an empty set of flags.
*/
public RevFlagSet() {
active = new ArrayList<>();
}
@ -86,6 +89,7 @@ public RevFlagSet(final Collection<RevFlag> s) {
addAll(s);
}
/** {@inheritDoc} */
@Override
public boolean contains(final Object o) {
if (o instanceof RevFlag)
@ -93,6 +97,7 @@ public boolean contains(final Object o) {
return false;
}
/** {@inheritDoc} */
@Override
public boolean containsAll(final Collection<?> c) {
if (c instanceof RevFlagSet) {
@ -102,6 +107,7 @@ public boolean containsAll(final Collection<?> c) {
return super.containsAll(c);
}
/** {@inheritDoc} */
@Override
public boolean add(final RevFlag flag) {
if ((mask & flag.mask) != 0)
@ -114,6 +120,7 @@ public boolean add(final RevFlag flag) {
return true;
}
/** {@inheritDoc} */
@Override
public boolean remove(final Object o) {
final RevFlag flag = (RevFlag) o;
@ -126,6 +133,7 @@ public boolean remove(final Object o) {
return true;
}
/** {@inheritDoc} */
@Override
public Iterator<RevFlag> iterator() {
final Iterator<RevFlag> i = active.iterator();
@ -150,6 +158,7 @@ public void remove() {
};
}
/** {@inheritDoc} */
@Override
public int size() {
return active.size();

View File

@ -52,7 +52,9 @@
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdOwnerMap;
/** Base object type accessed during revision walking. */
/**
* Base object type accessed during revision walking.
*/
public abstract class RevObject extends ObjectIdOwnerMap.Entry {
static final int PARSED = 1;
@ -69,7 +71,7 @@ abstract void parseBody(RevWalk walk) throws MissingObjectException,
IncorrectObjectTypeException, IOException;
/**
* Get Git object type. See {@link Constants}.
* Get Git object type. See {@link org.eclipse.jgit.lib.Constants}.
*
* @return object type
*/
@ -163,6 +165,7 @@ public final void remove(final RevFlagSet set) {
flags &= ~set.mask;
}
/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder s = new StringBuilder();
@ -175,6 +178,8 @@ public String toString() {
}
/**
* Append a debug description of core RevFlags to a buffer.
*
* @param s
* buffer to append a debug description of core RevFlags onto.
*/

View File

@ -51,7 +51,7 @@
import org.eclipse.jgit.internal.JGitText;
/**
* An ordered list of {@link RevObject} subclasses.
* An ordered list of {@link org.eclipse.jgit.revwalk.RevObject} subclasses.
*
* @param <E>
* type of subclass of RevObject the list is storing.
@ -73,11 +73,14 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {
/** Current number of elements in the list. */
protected int size = 0;
/** Create an empty object list. */
/**
* Create an empty object list.
*/
public RevObjectList() {
// Initialized above.
}
/** {@inheritDoc} */
@Override
public void add(final int index, final E element) {
if (index != size)
@ -88,6 +91,7 @@ public void add(final int index, final E element) {
size++;
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public E set(int index, E element) {
@ -109,6 +113,7 @@ public E set(int index, E element) {
return (E) old;
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public E get(int index) {
@ -123,11 +128,13 @@ public E get(int index) {
return s != null ? (E) s.contents[index] : null;
}
/** {@inheritDoc} */
@Override
public int size() {
return size;
}
/** {@inheritDoc} */
@Override
public void clear() {
contents = new Block(0);

View File

@ -44,7 +44,10 @@
package org.eclipse.jgit.revwalk;
/** Sorting strategies supported by {@link RevWalk} and {@link ObjectWalk}. */
/**
* Sorting strategies supported by {@link org.eclipse.jgit.revwalk.RevWalk} and
* {@link org.eclipse.jgit.revwalk.ObjectWalk}.
*/
public enum RevSort {
/**
* No specific sorting is requested.

View File

@ -64,7 +64,9 @@
import org.eclipse.jgit.util.RawParseUtils;
import org.eclipse.jgit.util.StringUtils;
/** An annotated tag. */
/**
* An annotated tag.
*/
public class RevTag extends RevObject {
/**
* Parse an annotated tag from its canonical format.
@ -75,14 +77,15 @@ public class RevTag extends RevObject {
* not have its headers loaded.
*
* Applications are discouraged from using this API. Callers usually need
* more than one object. Use {@link RevWalk#parseTag(AnyObjectId)} to obtain
* more than one object. Use
* {@link org.eclipse.jgit.revwalk.RevWalk#parseTag(AnyObjectId)} to obtain
* a RevTag from an existing repository.
*
* @param raw
* the canonical formatted tag to be parsed.
* @return the parsed tag, in an isolated revision pool that is not
* available to the caller.
* @throws CorruptObjectException
* @throws org.eclipse.jgit.errors.CorruptObjectException
* the tag contains a malformed header that cannot be handled.
*/
public static RevTag parse(byte[] raw) throws CorruptObjectException {
@ -109,7 +112,7 @@ public static RevTag parse(byte[] raw) throws CorruptObjectException {
* modified by the caller.
* @return the parsed tag, in an isolated revision pool that is not
* available to the caller.
* @throws CorruptObjectException
* @throws org.eclipse.jgit.errors.CorruptObjectException
* the tag contains a malformed header that cannot be handled.
*/
public static RevTag parse(RevWalk rw, byte[] raw)
@ -173,6 +176,7 @@ void parseCanonical(final RevWalk walk, final byte[] rawTag)
flags |= PARSED;
}
/** {@inheritDoc} */
@Override
public final int getType() {
return Constants.OBJ_TAG;
@ -261,12 +265,15 @@ private Charset guessEncoding() {
* Get a reference to the object this tag was placed on.
* <p>
* Note that the returned object has only been looked up (see
* {@link RevWalk#lookupAny(AnyObjectId, int)}. To access the contents it
* needs to be parsed, see {@link RevWalk#parseHeaders(RevObject)} and
* {@link RevWalk#parseBody(RevObject)}.
* {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}. To
* access the contents it needs to be parsed, see
* {@link org.eclipse.jgit.revwalk.RevWalk#parseHeaders(RevObject)} and
* {@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.
* <p>
* As an alternative, use {@link RevWalk#peel(RevObject)} and pass this
* {@link RevTag} to peel it until the first non-tag object.
* As an alternative, use
* {@link org.eclipse.jgit.revwalk.RevWalk#peel(RevObject)} and pass this
* {@link org.eclipse.jgit.revwalk.RevTag} to peel it until the first
* non-tag object.
*
* @return object this tag refers to (only looked up, not parsed)
*/
@ -290,7 +297,7 @@ public final String getTagName() {
* only the {@link #getObject()} pointer and {@link #getTagName()}.
* Accessing other properties such as {@link #getTaggerIdent()} or either
* message function requires reloading the buffer by invoking
* {@link RevWalk#parseBody(RevObject)}.
* {@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.
*
* @since 4.0
*/

View File

@ -52,7 +52,9 @@
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
/** A reference to a tree of subtrees/files. */
/**
* A reference to a tree of subtrees/files.
*/
public class RevTree extends RevObject {
/**
* Create a new tree reference.
@ -64,6 +66,7 @@ protected RevTree(final AnyObjectId id) {
super(id);
}
/** {@inheritDoc} */
@Override
public final int getType() {
return Constants.OBJ_TREE;

View File

@ -84,10 +84,12 @@
* usage of a RevWalk instance to a single thread, or implement their own
* synchronization at a higher level.
* <p>
* Multiple simultaneous RevWalk instances per {@link Repository} are permitted,
* even from concurrent threads. Equality of {@link RevCommit}s from two
* different RevWalk instances is never true, even if their {@link ObjectId}s
* are equal (and thus they describe the same commit).
* Multiple simultaneous RevWalk instances per
* {@link org.eclipse.jgit.lib.Repository} are permitted, even from concurrent
* threads. Equality of {@link org.eclipse.jgit.revwalk.RevCommit}s from two
* different RevWalk instances is never true, even if their
* {@link org.eclipse.jgit.lib.ObjectId}s are equal (and thus they describe the
* same commit).
* <p>
* The offered iterator is over the list of RevCommits described by the
* configuration of this instance. Applications should restrict themselves to
@ -236,12 +238,18 @@ private RevWalk(ObjectReader or, boolean closeReader) {
this.closeReader = closeReader;
}
/** @return the reader this walker is using to load objects. */
/**
* Get the reader this walker is using to load objects.
*
* @return the reader this walker is using to load objects.
*/
public ObjectReader getObjectReader() {
return reader;
}
/**
* {@inheritDoc}
* <p>
* Release any resources used by this walker's reader.
* <p>
* A walker that has been released can be used again, but may need to be
@ -272,17 +280,17 @@ public void close() {
* @param c
* the commit to start traversing from. The commit passed must be
* from this same revision walker.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the commit supplied is not available from the object
* database. This usually indicates the supplied commit is
* invalid, but the reference was constructed during an earlier
* invocation to {@link #lookupCommit(AnyObjectId)}.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the object was not parsed yet and it was discovered during
* parsing that it is not actually a commit. This usually
* indicates the caller supplied a non-commit SHA-1 to
* {@link #lookupCommit(AnyObjectId)}.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void markStart(final RevCommit c) throws MissingObjectException,
@ -302,17 +310,17 @@ public void markStart(final RevCommit c) throws MissingObjectException,
* @param list
* commits to start traversing from. The commits passed must be
* from this same revision walker.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* one of the commits supplied is not available from the object
* database. This usually indicates the supplied commit is
* invalid, but the reference was constructed during an earlier
* invocation to {@link #lookupCommit(AnyObjectId)}.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the object was not parsed yet and it was discovered during
* parsing that it is not actually a commit. This usually
* indicates the caller supplied a non-commit SHA-1 to
* {@link #lookupCommit(AnyObjectId)}.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void markStart(final Collection<RevCommit> list)
@ -342,17 +350,17 @@ public void markStart(final Collection<RevCommit> list)
* @param c
* the commit to start traversing from. The commit passed must be
* from this same revision walker.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the commit supplied is not available from the object
* database. This usually indicates the supplied commit is
* invalid, but the reference was constructed during an earlier
* invocation to {@link #lookupCommit(AnyObjectId)}.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the object was not parsed yet and it was discovered during
* parsing that it is not actually a commit. This usually
* indicates the caller supplied a non-commit SHA-1 to
* {@link #lookupCommit(AnyObjectId)}.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void markUninteresting(final RevCommit c)
@ -383,14 +391,14 @@ public void markUninteresting(final RevCommit c)
* @return true if there is a path directly from <code>tip</code> to
* <code>base</code> (and thus <code>base</code> is fully merged
* into <code>tip</code>); false otherwise.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* one or or more of the next commit's parents are not available
* from the object database, but were thought to be candidates
* for traversal. This usually indicates a broken link.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* one or or more of the next commit's parents are not actually
* commit objects.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public boolean isMergedInto(final RevCommit base, final RevCommit tip)
@ -420,14 +428,14 @@ public boolean isMergedInto(final RevCommit base, final RevCommit tip)
* Pop the next most recent commit.
*
* @return next most recent commit; null if traversal is over.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* one or or more of the next commit's parents are not available
* from the object database, but were thought to be candidates
* for traversal. This usually indicates a broken link.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* one or or more of the next commit's parents are not actually
* commit objects.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevCommit next() throws MissingObjectException,
@ -439,7 +447,8 @@ public RevCommit next() throws MissingObjectException,
* Obtain the sort types applied to the commits returned.
*
* @return the sorting strategies employed. At least one strategy is always
* used, but that strategy may be {@link RevSort#NONE}.
* used, but that strategy may be
* {@link org.eclipse.jgit.revwalk.RevSort#NONE}.
*/
public EnumSet<RevSort> getRevSort() {
return sorting.clone();
@ -475,8 +484,9 @@ public void sort(final RevSort s) {
* Add or remove a sorting strategy for the returned commits.
* <p>
* Multiple strategies can be applied at once, in which case some strategies
* may take precedence over others. As an example, {@link RevSort#TOPO} must
* take precedence over {@link RevSort#COMMIT_TIME_DESC}, otherwise it
* may take precedence over others. As an example,
* {@link org.eclipse.jgit.revwalk.RevSort#TOPO} must take precedence over
* {@link org.eclipse.jgit.revwalk.RevSort#COMMIT_TIME_DESC}, otherwise it
* cannot enforce its ordering.
*
* @param s
@ -518,12 +528,14 @@ public RevFilter getRevFilter() {
* Note that filters are not thread-safe and may not be shared by concurrent
* RevWalk instances. Every RevWalk must be supplied its own unique filter,
* unless the filter implementation specifically states it is (and always
* will be) thread-safe. Callers may use {@link RevFilter#clone()} to create
* a unique filter tree for this RevWalk instance.
* will be) thread-safe. Callers may use
* {@link org.eclipse.jgit.revwalk.filter.RevFilter#clone()} to create a
* unique filter tree for this RevWalk instance.
*
* @param newFilter
* the new filter. If null the special {@link RevFilter#ALL}
* filter will be used instead, as it matches every commit.
* the new filter. If null the special
* {@link org.eclipse.jgit.revwalk.filter.RevFilter#ALL} filter
* will be used instead, as it matches every commit.
* @see org.eclipse.jgit.revwalk.filter.AndRevFilter
* @see org.eclipse.jgit.revwalk.filter.OrRevFilter
*/
@ -536,7 +548,9 @@ public void setRevFilter(final RevFilter newFilter) {
* Get the tree filter used to simplify commits by modified paths.
*
* @return the current filter. Never null as a filter is always needed. If
* no filter is being applied {@link TreeFilter#ALL} is returned.
* no filter is being applied
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} is
* returned.
*/
public TreeFilter getTreeFilter() {
return treeFilter;
@ -545,20 +559,23 @@ public TreeFilter getTreeFilter() {
/**
* Set the tree filter used to simplify commits by modified paths.
* <p>
* If null or {@link TreeFilter#ALL} the path limiter is removed. Commits
* will not be simplified.
* If null or {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} the
* path limiter is removed. Commits will not be simplified.
* <p>
* If non-null and not {@link TreeFilter#ALL} then the tree filter will be
* installed. Commits will have their ancestry simplified to hide commits that
* do not contain tree entries matched by the filter, unless
* {@code setRewriteParents(false)} is called.
* If non-null and not
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} then the tree
* filter will be installed. Commits will have their ancestry simplified to
* hide commits that do not contain tree entries matched by the filter,
* unless {@code setRewriteParents(false)} is called.
* <p>
* Usually callers should be inserting a filter graph including
* {@link TreeFilter#ANY_DIFF} along with one or more
* {@link org.eclipse.jgit.treewalk.filter.PathFilter} instances.
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ANY_DIFF} along with
* one or more {@link org.eclipse.jgit.treewalk.filter.PathFilter}
* instances.
*
* @param newFilter
* new filter. If null the special {@link TreeFilter#ALL} filter
* new filter. If null the special
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} filter
* will be used instead, as it matches everything.
* @see org.eclipse.jgit.treewalk.filter.PathFilter
*/
@ -571,9 +588,9 @@ public void setTreeFilter(final TreeFilter newFilter) {
* Set whether to rewrite parent pointers when filtering by modified paths.
* <p>
* By default, when {@link #setTreeFilter(TreeFilter)} is called with non-
* null and non-{@link TreeFilter#ALL} filter, commits will have their
* ancestry simplified and parents rewritten to hide commits that do not match
* the filter.
* null and non-{@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL}
* filter, commits will have their ancestry simplified and parents rewritten
* to hide commits that do not match the filter.
* <p>
* This behavior can be bypassed by passing false to this method.
*
@ -596,8 +613,8 @@ boolean getRewriteParents() {
* care and would prefer to discard the body of a commit as early as
* possible, to reduce memory usage.
* <p>
* True by default on {@link RevWalk} and false by default for
* {@link ObjectWalk}.
* True by default on {@link org.eclipse.jgit.revwalk.RevWalk} and false by
* default for {@link org.eclipse.jgit.revwalk.ObjectWalk}.
*
* @return true if the body should be retained; false it is discarded.
*/
@ -608,14 +625,15 @@ public boolean isRetainBody() {
/**
* Set whether or not the body of a commit or tag is retained.
* <p>
* If a body of a commit or tag is not retained, the application must
* call {@link #parseBody(RevObject)} before the body can be safely
* accessed through the type specific access methods.
* If a body of a commit or tag is not retained, the application must call
* {@link #parseBody(RevObject)} before the body can be safely accessed
* through the type specific access methods.
* <p>
* True by default on {@link RevWalk} and false by default for
* {@link ObjectWalk}.
* True by default on {@link org.eclipse.jgit.revwalk.RevWalk} and false by
* default for {@link org.eclipse.jgit.revwalk.ObjectWalk}.
*
* @param retain true to retain bodies; false to discard them early.
* @param retain
* true to retain bodies; false to discard them early.
*/
public void setRetainBody(final boolean retain) {
retainBody = retain;
@ -759,11 +777,11 @@ public RevObject lookupOrNull(AnyObjectId id) {
* @param id
* name of the commit object.
* @return reference to the commit object. Never null.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the supplied commit does not exist.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the supplied id is not a commit or an annotated tag.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevCommit parseCommit(final AnyObjectId id)
@ -786,11 +804,11 @@ public RevCommit parseCommit(final AnyObjectId id)
* name of the tree object, or a commit or annotated tag that may
* reference a tree.
* @return reference to the tree object. Never null.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the supplied tree does not exist.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the supplied id is not a tree, a commit or an annotated tag.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevTree parseTree(final AnyObjectId id)
@ -820,11 +838,11 @@ else if (!(c instanceof RevTree))
* @param id
* name of the tag object.
* @return reference to the tag object. Never null.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the supplied tag does not exist.
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* the supplied id is not a tag or an annotated tag.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevTag parseTag(final AnyObjectId id) throws MissingObjectException,
@ -847,9 +865,9 @@ public RevTag parseTag(final AnyObjectId id) throws MissingObjectException,
* @param id
* name of the object.
* @return reference to the object. Never null.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the supplied does not exist.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevObject parseAny(final AnyObjectId id)
@ -916,8 +934,6 @@ byte[] getCachedBytes(RevObject obj, ObjectLoader ldr)
/**
* Asynchronous object parsing.
*
* @param <T>
* any ObjectId type.
* @param objectIds
* objects to open from the object store. The supplied collection
* must not be modified until the queue has finished.
@ -1007,9 +1023,9 @@ public void release() {
*
* @param obj
* the object the caller needs to be parsed.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the supplied does not exist.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void parseHeaders(final RevObject obj)
@ -1026,9 +1042,9 @@ public void parseHeaders(final RevObject obj)
*
* @param obj
* the object the caller needs to be parsed.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* the supplied does not exist.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public void parseBody(final RevObject obj)
@ -1044,9 +1060,9 @@ public void parseBody(final RevObject obj)
* @return If {@code obj} is not an annotated tag, {@code obj}. Otherwise
* the first non-tag object that {@code obj} references. The
* returned object's headers have been parsed.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* a referenced object cannot be found.
* @throws IOException
* @throws java.io.IOException
* a pack file or loose object could not be read.
*/
public RevObject peel(RevObject obj) throws MissingObjectException,
@ -1069,7 +1085,7 @@ public RevObject peel(RevObject obj) throws MissingObjectException,
* @param name
* description of the flag, primarily useful for debugging.
* @return newly constructed flag instance.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* too many flags have been reserved on this revision walker.
*/
public RevFlag newFlag(final String name) {
@ -1308,6 +1324,8 @@ public void dispose() {
}
/**
* {@inheritDoc}
* <p>
* Returns an Iterator over the commits of this walker.
* <p>
* The returned iterator is only useful for one walk. If this RevWalk gets
@ -1316,10 +1334,9 @@ public void dispose() {
* Applications must not use both the Iterator and the {@link #next()} API
* at the same time. Pick one API and use that for the entire walk.
* <p>
* If a checked exception is thrown during the walk (see {@link #next()})
* it is rethrown from the Iterator as a {@link RevWalkException}.
* If a checked exception is thrown during the walk (see {@link #next()}) it
* is rethrown from the Iterator as a {@link RevWalkException}.
*
* @return an iterator over this walker's commits.
* @see RevWalkException
*/
@Override
@ -1365,7 +1382,9 @@ public void remove() {
};
}
/** Throws an exception if we have started producing output. */
/**
* Throws an exception if we have started producing output.
*/
protected void assertNotStarted() {
if (isNotStarted())
return;
@ -1377,7 +1396,8 @@ private boolean isNotStarted() {
}
/**
* Create and return an {@link ObjectWalk} using the same objects.
* Create and return an {@link org.eclipse.jgit.revwalk.ObjectWalk} using
* the same objects.
* <p>
* Prior to using this method, the caller must reset this RevWalk to clean
* any flags that were used during the last traversal.

View File

@ -53,7 +53,7 @@
import org.eclipse.jgit.lib.Ref;
/**
* Utility methods for {@link RevWalk}.
* Utility methods for {@link org.eclipse.jgit.revwalk.RevWalk}.
*/
public final class RevWalkUtils {
@ -67,9 +67,10 @@ private RevWalkUtils() {
* other words, count the number of commits that are in <code>start</code>,
* but not in <code>end</code>.
* <p>
* Note that this method calls {@link 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.
* Note that this method calls
* {@link org.eclipse.jgit.revwalk.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.
*
* @param walk
* the rev walk to use
@ -78,11 +79,10 @@ private RevWalkUtils() {
* @param end
* the commit where counting should end, or null if counting
* should be done until there are no more commits
*
* @return the number of commits
* @throws MissingObjectException
* @throws IncorrectObjectTypeException
* @throws IOException
* @throws org.eclipse.jgit.errors.MissingObjectException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* @throws java.io.IOException
*/
public static int count(final RevWalk walk, final RevCommit start,
final RevCommit end) throws MissingObjectException,
@ -96,9 +96,10 @@ public static int count(final RevWalk walk, final RevCommit start,
* Find of commits that are in <code>start</code>, but not in
* <code>end</code>.
* <p>
* Note that this method calls {@link 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.
* Note that this method calls
* {@link org.eclipse.jgit.revwalk.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.
*
* @param walk
* the rev walk to use
@ -108,9 +109,9 @@ public static int count(final RevWalk walk, final RevCommit start,
* the commit where counting should end, or null if counting
* should be done until there are no more commits
* @return the commits found
* @throws MissingObjectException
* @throws IncorrectObjectTypeException
* @throws IOException
* @throws org.eclipse.jgit.errors.MissingObjectException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* @throws java.io.IOException
*/
public static List<RevCommit> find(final RevWalk walk,
final RevCommit start, final RevCommit end)
@ -131,7 +132,8 @@ public static List<RevCommit> find(final RevWalk walk,
* Find the list of branches a given commit is reachable from when following
* parent.s
* <p>
* Note that this method calls {@link RevWalk#reset()} at the beginning.
* Note that this method calls
* {@link org.eclipse.jgit.revwalk.RevWalk#reset()} at the beginning.
* <p>
* In order to improve performance this method assumes clock skew among
* committers is never larger than 24 hours.
@ -143,9 +145,9 @@ public static List<RevCommit> find(final RevWalk walk,
* @param refs
* the set of branches we want to see reachability from
* @return the list of branches a given commit is reachable from
* @throws MissingObjectException
* @throws IncorrectObjectTypeException
* @throws IOException
* @throws org.eclipse.jgit.errors.MissingObjectException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* @throws java.io.IOException
*/
public static List<Ref> findBranchesReachableFrom(RevCommit commit,
RevWalk revWalk, Collection<Ref> refs)

View File

@ -60,10 +60,12 @@
import org.eclipse.jgit.treewalk.filter.TreeFilter;
/**
* Filter applying a {@link TreeFilter} against changed paths in each commit.
* Filter applying a {@link org.eclipse.jgit.treewalk.filter.TreeFilter} against
* changed paths in each commit.
* <p>
* Each commit is differenced concurrently against all of its parents to look
* for tree entries that are interesting to the {@link TreeFilter}.
* for tree entries that are interesting to the
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter}.
*
* @since 3.5
*/
@ -76,14 +78,15 @@ public class TreeRevFilter extends RevFilter {
private final TreeWalk pathFilter;
/**
* Create a {@link RevFilter} from a {@link TreeFilter}.
* Create a {@link org.eclipse.jgit.revwalk.filter.RevFilter} from a
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter}.
*
* @param walker
* walker used for reading trees.
* @param t
* filter to compare against any changed paths in each commit. If a
* {@link FollowFilter}, will be replaced with a new filter
* following new paths after a rename.
* filter to compare against any changed paths in each commit. If
* a {@link org.eclipse.jgit.revwalk.FollowFilter}, will be
* replaced with a new filter following new paths after a rename.
* @since 3.5
*/
public TreeRevFilter(final RevWalk walker, final TreeFilter t) {
@ -121,11 +124,13 @@ public TreeRevFilter(final RevWalk walker, final TreeFilter t) {
this.rewriteFlag = rewriteFlag;
}
/** {@inheritDoc} */
@Override
public RevFilter clone() {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public boolean include(final RevWalk walker, final RevCommit c)
throws StopWalkException, MissingObjectException,
@ -260,6 +265,7 @@ public boolean include(final RevWalk walker, final RevCommit c)
return false;
}
/** {@inheritDoc} */
@Override
public boolean requiresCommitBody() {
return false;

View File

@ -57,9 +57,10 @@
* Includes a commit only if all subfilters include the same commit.
* <p>
* Classic shortcut behavior is used, so evaluation of the
* {@link RevFilter#include(RevWalk, RevCommit)} method stops as soon as a false
* result is obtained. Applications can improve filtering performance by placing
* faster filters that are more likely to reject a result earlier in the list.
* {@link org.eclipse.jgit.revwalk.filter.RevFilter#include(RevWalk, RevCommit)}
* method stops as soon as a false result is obtained. Applications can improve
* filtering performance by placing faster filters that are more likely to
* reject a result earlier in the list.
*/
public abstract class AndRevFilter extends RevFilter {
/**

View File

@ -50,7 +50,9 @@
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawParseUtils;
/** Matches only commits whose author name matches the pattern. */
/**
* Matches only commits whose author name matches the pattern.
*/
public class AuthorRevFilter {
/**
* Create a new author filter.

View File

@ -53,7 +53,9 @@
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
/** Selects commits based upon the commit time field. */
/**
* Selects commits based upon the commit time field.
*/
public abstract class CommitTimeRevFilter extends RevFilter {
/**
* Create a new filter to select commits before a given date/time.
@ -129,11 +131,13 @@ public static final RevFilter between(final long since, final long until) {
when = (int) (ts / 1000);
}
/** {@inheritDoc} */
@Override
public RevFilter clone() {
return this;
}
/** {@inheritDoc} */
@Override
public boolean requiresCommitBody() {
return false;

View File

@ -50,7 +50,9 @@
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawParseUtils;
/** Matches only commits whose committer name matches the pattern. */
/**
* Matches only commits whose committer name matches the pattern.
*/
public class CommitterRevFilter {
/**
* Create a new committer filter.

View File

@ -79,6 +79,7 @@ private MaxCountRevFilter(int maxCount) {
this.maxCount = maxCount;
}
/** {@inheritDoc} */
@Override
public boolean include(RevWalk walker, RevCommit cmit)
throws StopWalkException, MissingObjectException,
@ -89,6 +90,7 @@ public boolean include(RevWalk walker, RevCommit cmit)
return true;
}
/** {@inheritDoc} */
@Override
public RevFilter clone() {
return new MaxCountRevFilter(maxCount);

View File

@ -50,7 +50,9 @@
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawParseUtils;
/** Matches only commits whose message matches the pattern. */
/**
* Matches only commits whose message matches the pattern.
*/
public class MessageRevFilter {
/**
* Create a message filter.

View File

@ -50,7 +50,9 @@
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
/** Includes a commit only if the subfilter does not include the commit. */
/**
* Includes a commit only if the subfilter does not include the commit.
*/
public class NotRevFilter extends RevFilter {
/**
* Create a filter that negates the result of another filter.
@ -69,11 +71,13 @@ private NotRevFilter(final RevFilter one) {
a = one;
}
/** {@inheritDoc} */
@Override
public RevFilter negate() {
return a;
}
/** {@inheritDoc} */
@Override
public boolean include(final RevWalk walker, final RevCommit c)
throws MissingObjectException, IncorrectObjectTypeException,
@ -81,16 +85,19 @@ public boolean include(final RevWalk walker, final RevCommit c)
return !a.include(walker, c);
}
/** {@inheritDoc} */
@Override
public boolean requiresCommitBody() {
return a.requiresCommitBody();
}
/** {@inheritDoc} */
@Override
public RevFilter clone() {
return new NotRevFilter(a.clone());
}
/** {@inheritDoc} */
@Override
public String toString() {
return "NOT " + a.toString(); //$NON-NLS-1$

View File

@ -54,7 +54,8 @@
* Selects interesting objects when walking.
* <p>
* Applications should install the filter on an ObjectWalk by
* {@link ObjectWalk#setObjectFilter(ObjectFilter)} prior to starting traversal.
* {@link org.eclipse.jgit.revwalk.ObjectWalk#setObjectFilter(ObjectFilter)}
* prior to starting traversal.
*
* @since 4.0
*/
@ -77,13 +78,13 @@ public boolean include(ObjectWalk walker, AnyObjectId o) {
* @param objid
* the object currently being tested.
* @return {@code true} if the named object should be included in the walk.
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* an object the filter needed to consult to determine its
* answer was missing
* @throws IncorrectObjectTypeException
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* an object the filter needed to consult to determine its
* answer was of the wrong type
* @throws IOException
* @throws java.io.IOException
* an object the filter needed to consult to determine its
* answer could not be read.
*/

View File

@ -57,9 +57,10 @@
* Includes a commit if any subfilters include the same commit.
* <p>
* Classic shortcut behavior is used, so evaluation of the
* {@link RevFilter#include(RevWalk, RevCommit)} method stops as soon as a true
* result is obtained. Applications can improve filtering performance by placing
* faster filters that are more likely to accept a result earlier in the list.
* {@link org.eclipse.jgit.revwalk.filter.RevFilter#include(RevWalk, RevCommit)}
* method stops as soon as a true result is obtained. Applications can improve
* filtering performance by placing faster filters that are more likely to
* accept a result earlier in the list.
*/
public abstract class OrRevFilter extends RevFilter {
/**

View File

@ -56,7 +56,9 @@
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.util.RawCharSequence;
/** Abstract filter that searches text using extended regular expressions. */
/**
* Abstract filter that searches text using extended regular expressions.
*/
public abstract class PatternMatchRevFilter extends RevFilter {
/**
* Encode a string pattern for faster matching on byte arrays.
@ -69,7 +71,7 @@ public abstract class PatternMatchRevFilter extends RevFilter {
* original pattern string supplied by the user or the
* application.
* @return same pattern, but re-encoded to match our funny raw UTF-8
* character sequence {@link RawCharSequence}.
* character sequence {@link org.eclipse.jgit.util.RawCharSequence}.
*/
protected static final String forceToRaw(final String patternText) {
final byte[] b = Constants.encode(patternText);
@ -97,7 +99,8 @@ protected static final String forceToRaw(final String patternText) {
* should {@link #forceToRaw(String)} be applied to the pattern
* before compiling it?
* @param flags
* flags from {@link Pattern} to control how matching performs.
* flags from {@link java.util.regex.Pattern} to control how
* matching performs.
*/
protected PatternMatchRevFilter(String pattern, final boolean innerString,
final boolean rawEncoding, final int flags) {
@ -124,6 +127,7 @@ public String pattern() {
return patternText;
}
/** {@inheritDoc} */
@Override
public boolean include(final RevWalk walker, final RevCommit cmit)
throws MissingObjectException, IncorrectObjectTypeException,
@ -131,6 +135,7 @@ public boolean include(final RevWalk walker, final RevCommit cmit)
return compiledPattern.reset(text(cmit)).matches();
}
/** {@inheritDoc} */
@Override
public boolean requiresCommitBody() {
return true;
@ -145,6 +150,7 @@ public boolean requiresCommitBody() {
*/
protected abstract CharSequence text(RevCommit cmit);
/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

View File

@ -61,7 +61,8 @@
* <code>OrRevFilter</code> to create complex boolean expressions.
* <p>
* Applications should install the filter on a RevWalk by
* {@link RevWalk#setRevFilter(RevFilter)} prior to starting traversal.
* {@link org.eclipse.jgit.revwalk.RevWalk#setRevFilter(RevFilter)} prior to
* starting traversal.
* <p>
* Unless specifically noted otherwise a RevFilter implementation is not thread
* safe and may not be shared by different RevWalk instances at the same time.
@ -73,9 +74,12 @@
* <p>
* <b>Message filters:</b>
* <ul>
* <li>Author name/email: {@link AuthorRevFilter}</li>
* <li>Committer name/email: {@link CommitterRevFilter}</li>
* <li>Message body: {@link MessageRevFilter}</li>
* <li>Author name/email:
* {@link org.eclipse.jgit.revwalk.filter.AuthorRevFilter}</li>
* <li>Committer name/email:
* {@link org.eclipse.jgit.revwalk.filter.CommitterRevFilter}</li>
* <li>Message body:
* {@link org.eclipse.jgit.revwalk.filter.MessageRevFilter}</li>
* </ul>
*
* <p>
@ -88,9 +92,9 @@
* <p>
* <b>Boolean modifiers:</b>
* <ul>
* <li>AND: {@link AndRevFilter}</li>
* <li>OR: {@link OrRevFilter}</li>
* <li>NOT: {@link NotRevFilter}</li>
* <li>AND: {@link org.eclipse.jgit.revwalk.filter.AndRevFilter}</li>
* <li>OR: {@link org.eclipse.jgit.revwalk.filter.OrRevFilter}</li>
* <li>NOT: {@link org.eclipse.jgit.revwalk.filter.NotRevFilter}</li>
* </ul>
*/
public abstract class RevFilter {
@ -241,7 +245,11 @@ public RevFilter negate() {
return NotRevFilter.create(this);
}
/** @return true if the filter needs the commit body to be parsed. */
/**
* Whether the filter needs the commit body to be parsed.
*
* @return true if the filter needs the commit body to be parsed.
*/
public boolean requiresCommitBody() {
// Assume true to be backward compatible with prior behavior.
return true;
@ -258,19 +266,19 @@ public boolean requiresCommitBody() {
* 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 StopWalkException
* @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 MissingObjectException
* @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 IncorrectObjectTypeException
* @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 IOException
* @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.
*/
@ -279,16 +287,17 @@ public abstract boolean include(RevWalk walker, RevCommit cmit)
IncorrectObjectTypeException, IOException;
/**
* {@inheritDoc}
* <p>
* Clone this revision filter, including its parameters.
* <p>
* This is a deep clone. If this filter embeds objects or other filters it
* must also clone those, to ensure the instances do not share mutable data.
*
* @return another copy of this filter, suitable for another thread.
*/
@Override
public abstract RevFilter clone();
/** {@inheritDoc} */
@Override
public String toString() {
String n = getClass().getName();

View File

@ -52,7 +52,9 @@
import org.eclipse.jgit.revwalk.RevFlagSet;
import org.eclipse.jgit.revwalk.RevWalk;
/** Matches only commits with some/all RevFlags already set. */
/**
* Matches only commits with some/all RevFlags already set.
*/
public abstract class RevFlagFilter extends RevFilter {
/**
* Create a new filter that tests for a single flag.
@ -123,11 +125,13 @@ public static RevFilter hasAny(final RevFlagSet a) {
flags = m;
}
/** {@inheritDoc} */
@Override
public RevFilter clone() {
return this;
}
/** {@inheritDoc} */
@Override
public String toString() {
return super.toString() + flags;

View File

@ -78,6 +78,7 @@ private SkipRevFilter(int skip) {
this.skip = skip;
}
/** {@inheritDoc} */
@Override
public boolean include(RevWalk walker, RevCommit cmit)
throws StopWalkException, MissingObjectException,
@ -87,6 +88,7 @@ public boolean include(RevWalk walker, RevCommit cmit)
return true;
}
/** {@inheritDoc} */
@Override
public RevFilter clone() {
return new SkipRevFilter(skip);

View File

@ -52,7 +52,9 @@
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawSubStringPattern;
/** Abstract filter that searches text using only substring search. */
/**
* Abstract filter that searches text using only substring search.
*/
public abstract class SubStringRevFilter extends RevFilter {
/**
* Can this string be safely handled by a substring filter?
@ -60,7 +62,8 @@ public abstract class SubStringRevFilter extends RevFilter {
* @param pattern
* the pattern text proposed by the user.
* @return true if a substring filter can perform this pattern match; false
* if {@link PatternMatchRevFilter} must be used instead.
* if {@link org.eclipse.jgit.revwalk.filter.PatternMatchRevFilter}
* must be used instead.
*/
public static boolean safe(final String pattern) {
for (int i = 0; i < pattern.length(); i++) {
@ -97,6 +100,7 @@ protected SubStringRevFilter(final String patternText) {
pattern = new RawSubStringPattern(patternText);
}
/** {@inheritDoc} */
@Override
public boolean include(final RevWalk walker, final RevCommit cmit)
throws MissingObjectException, IncorrectObjectTypeException,
@ -104,6 +108,7 @@ public boolean include(final RevWalk walker, final RevCommit cmit)
return pattern.match(text(cmit)) >= 0;
}
/** {@inheritDoc} */
@Override
public boolean requiresCommitBody() {
return true;
@ -118,11 +123,13 @@ public boolean requiresCommitBody() {
*/
protected abstract RawCharSequence text(RevCommit cmit);
/** {@inheritDoc} */
@Override
public RevFilter clone() {
return this; // Typically we are actually thread-safe.
}
/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {