Change-Id: I3fabab8afa284b1919ab7bc656cab19e56ed474e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>tags/v4.10.0.201712302008-r
@@ -103,14 +103,16 @@ abstract class AbstractRevQueue extends Generator { | |||
} | |||
/** | |||
* {@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 @@ abstract class AbstractRevQueue extends Generator { | |||
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'); |
@@ -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; |
@@ -102,21 +102,27 @@ public final class BitmapWalker { | |||
/** | |||
* 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, |
@@ -51,7 +51,9 @@ import org.eclipse.jgit.errors.MissingObjectException; | |||
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 @@ abstract class BlockRevQueue extends AbstractRevQueue { | |||
} | |||
/** | |||
* {@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 @@ abstract class BlockRevQueue extends AbstractRevQueue { | |||
* <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) { |
@@ -49,7 +49,9 @@ import java.io.IOException; | |||
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 class DateRevQueue extends AbstractRevQueue { | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void add(final RevCommit c) { | |||
sinceLastIndex++; | |||
@@ -127,6 +132,7 @@ public class DateRevQueue extends AbstractRevQueue { | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevCommit next() { | |||
final Entry q = head; | |||
@@ -163,6 +169,7 @@ public class DateRevQueue extends AbstractRevQueue { | |||
return head != null ? head.commit : null; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void clear() { | |||
head = null; | |||
@@ -196,6 +203,7 @@ public class DateRevQueue extends AbstractRevQueue { | |||
return outputType | SORT_COMMIT_TIME_DESC; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
final StringBuilder s = new StringBuilder(); |
@@ -52,15 +52,30 @@ import org.eclipse.jgit.lib.AnyObjectId; | |||
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. */ |
@@ -48,13 +48,17 @@ import java.io.IOException; | |||
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 class FIFORevQueue extends BlockRevQueue { | |||
super(s); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void add(final RevCommit c) { | |||
Block b = tail; | |||
@@ -108,6 +113,7 @@ public class FIFORevQueue extends BlockRevQueue { | |||
head = b; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevCommit next() { | |||
final Block b = head; | |||
@@ -124,6 +130,7 @@ public class FIFORevQueue extends BlockRevQueue { | |||
return c; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void clear() { | |||
head = null; | |||
@@ -159,6 +166,7 @@ public class FIFORevQueue extends BlockRevQueue { | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
final StringBuilder s = new StringBuilder(); |
@@ -59,7 +59,8 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter; | |||
* 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 class FollowFilter extends TreeFilter { | |||
} | |||
/** @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 class FollowFilter extends TreeFilter { | |||
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 class FollowFilter extends TreeFilter { | |||
} | |||
/** | |||
* Get the callback to which renames are reported. | |||
* | |||
* @return the callback to which renames are reported, or <code>null</code> | |||
* if none | |||
*/ |
@@ -47,7 +47,9 @@ import java.util.Locale; | |||
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 final class FooterKey { | |||
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() { |
@@ -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 final class FooterLine { | |||
} | |||
/** | |||
* 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 final class FooterLine { | |||
} | |||
/** | |||
* 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 final class FooterLine { | |||
return RawParseUtils.decode(enc, buffer, lt, gt - 1); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
return getKey() + ": " + getValue(); //$NON-NLS-1$ |
@@ -49,11 +49,15 @@ import java.io.IOException; | |||
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 class LIFORevQueue extends BlockRevQueue { | |||
super(s); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void add(final RevCommit c) { | |||
Block b = head; | |||
@@ -75,6 +80,7 @@ public class LIFORevQueue extends BlockRevQueue { | |||
b.unpop(c); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevCommit next() { | |||
final Block b = head; | |||
@@ -89,6 +95,7 @@ public class LIFORevQueue extends BlockRevQueue { | |||
return c; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void clear() { | |||
head = null; | |||
@@ -115,6 +122,7 @@ public class LIFORevQueue extends BlockRevQueue { | |||
return false; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
final StringBuilder s = new StringBuilder(); |
@@ -76,8 +76,9 @@ import org.eclipse.jgit.util.RawParseUtils; | |||
* 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 class ObjectWalk extends RevWalk { | |||
/** | |||
* 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 class ObjectWalk extends RevWalk { | |||
* 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 @@ public class ObjectWalk extends RevWalk { | |||
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 class ObjectWalk extends RevWalk { | |||
* 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 class ObjectWalk extends RevWalk { | |||
} | |||
/** | |||
* 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 class ObjectWalk extends RevWalk { | |||
* 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 class ObjectWalk extends RevWalk { | |||
objectFilter = newFilter != null ? newFilter : ObjectFilter.ALL; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevCommit next() throws MissingObjectException, | |||
IncorrectObjectTypeException, IOException { | |||
@@ -316,14 +329,14 @@ public class ObjectWalk extends RevWalk { | |||
* 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 @@ public class ObjectWalk extends RevWalk { | |||
* 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 class ObjectWalk extends RevWalk { | |||
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 @@ public class ObjectWalk extends RevWalk { | |||
pathBuf = newBuf; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void dispose() { | |||
super.dispose(); | |||
@@ -675,6 +697,7 @@ public class ObjectWalk extends RevWalk { | |||
freeVisit = null; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
protected void reset(final int retainFlags) { | |||
super.reset(retainFlags); |
@@ -46,8 +46,9 @@ import org.eclipse.jgit.diff.DiffEntry; | |||
/** | |||
* 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 { |
@@ -52,7 +52,9 @@ import org.eclipse.jgit.errors.MissingObjectException; | |||
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 @@ public class RevBlob extends RevObject { | |||
super(id); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public final int getType() { | |||
return Constants.OBJ_BLOB; |
@@ -66,7 +66,9 @@ import org.eclipse.jgit.lib.PersonIdent; | |||
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 class RevCommit extends RevObject { | |||
* 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 @@ public class RevCommit extends RevObject { | |||
flags |= PARSED; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public final int getType() { | |||
return Constants.OBJ_COMMIT; | |||
@@ -315,7 +319,7 @@ public class RevCommit extends RevObject { | |||
/** | |||
* 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 class RevCommit extends RevObject { | |||
* 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 class RevCommit extends RevObject { | |||
* 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 class RevCommit extends RevObject { | |||
* 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 class RevCommit extends RevObject { | |||
* 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 class RevCommit extends RevObject { | |||
buffer = null; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
final StringBuilder s = new StringBuilder(); |
@@ -50,7 +50,7 @@ import org.eclipse.jgit.errors.MissingObjectException; | |||
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 @@ import org.eclipse.jgit.revwalk.filter.RevFilter; | |||
public class RevCommitList<E extends RevCommit> extends RevObjectList<E> { | |||
private RevWalk walker; | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void clear() { | |||
super.clear(); | |||
@@ -77,15 +78,15 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> { | |||
* @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 class RevCommitList<E extends RevCommit> extends RevObjectList<E> { | |||
* 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 class RevCommitList<E extends RevCommit> extends RevObjectList<E> { | |||
* @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 class RevCommitList<E extends RevCommit> extends RevObjectList<E> { | |||
* 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) |
@@ -48,9 +48,10 @@ import java.text.MessageFormat; | |||
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 class RevFlag { | |||
return walker; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
return name; |
@@ -50,7 +50,8 @@ import java.util.Iterator; | |||
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 class RevFlagSet extends AbstractSet<RevFlag> { | |||
addAll(s); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean contains(final Object o) { | |||
if (o instanceof RevFlag) | |||
@@ -93,6 +97,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { | |||
return false; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean containsAll(final Collection<?> c) { | |||
if (c instanceof RevFlagSet) { | |||
@@ -102,6 +107,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { | |||
return super.containsAll(c); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean add(final RevFlag flag) { | |||
if ((mask & flag.mask) != 0) | |||
@@ -114,6 +120,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { | |||
return true; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean remove(final Object o) { | |||
final RevFlag flag = (RevFlag) o; | |||
@@ -126,6 +133,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { | |||
return true; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public Iterator<RevFlag> iterator() { | |||
final Iterator<RevFlag> i = active.iterator(); | |||
@@ -150,6 +158,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { | |||
}; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public int size() { | |||
return active.size(); |
@@ -52,7 +52,9 @@ import org.eclipse.jgit.lib.Constants; | |||
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 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry { | |||
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 abstract class RevObject extends ObjectIdOwnerMap.Entry { | |||
flags &= ~set.mask; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
final StringBuilder s = new StringBuilder(); | |||
@@ -175,6 +178,8 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry { | |||
} | |||
/** | |||
* Append a debug description of core RevFlags to a buffer. | |||
* | |||
* @param s | |||
* buffer to append a debug description of core RevFlags onto. | |||
*/ |
@@ -51,7 +51,7 @@ import java.util.AbstractList; | |||
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 class RevObjectList<E extends RevObject> extends AbstractList<E> { | |||
size++; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
@SuppressWarnings("unchecked") | |||
public E set(int index, E element) { | |||
@@ -109,6 +113,7 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> { | |||
return (E) old; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
@SuppressWarnings("unchecked") | |||
public E get(int index) { | |||
@@ -123,11 +128,13 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> { | |||
return s != null ? (E) s.contents[index] : null; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public int size() { | |||
return size; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void clear() { | |||
contents = new Block(0); |
@@ -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. |
@@ -64,7 +64,9 @@ import org.eclipse.jgit.util.MutableInteger; | |||
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 class RevTag extends RevObject { | |||
* 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 @@ public class RevTag extends RevObject { | |||
flags |= PARSED; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public final int getType() { | |||
return Constants.OBJ_TAG; | |||
@@ -261,12 +265,15 @@ public class RevTag extends RevObject { | |||
* 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 class RevTag extends RevObject { | |||
* 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 | |||
*/ |
@@ -52,7 +52,9 @@ import org.eclipse.jgit.errors.MissingObjectException; | |||
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 @@ public class RevTree extends RevObject { | |||
super(id); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public final int getType() { | |||
return Constants.OBJ_TREE; |
@@ -84,10 +84,12 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter; | |||
* 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 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
/** | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
/** | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
/** | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* @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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
} | |||
/** | |||
* {@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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
* 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 class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
}; | |||
} | |||
/** 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 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { | |||
} | |||
/** | |||
* 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. |
@@ -53,7 +53,7 @@ import org.eclipse.jgit.errors.MissingObjectException; | |||
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 @@ public final class 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 @@ public final class 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 final class RevWalkUtils { | |||
* 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 final class RevWalkUtils { | |||
* 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 final class RevWalkUtils { | |||
* 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 final class RevWalkUtils { | |||
* @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) |
@@ -60,10 +60,12 @@ import org.eclipse.jgit.treewalk.TreeWalk; | |||
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 class TreeRevFilter extends RevFilter { | |||
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 class TreeRevFilter extends RevFilter { | |||
return false; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean requiresCommitBody() { | |||
return false; |
@@ -57,9 +57,10 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
* 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 { | |||
/** |
@@ -50,7 +50,9 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
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. |
@@ -53,7 +53,9 @@ import org.eclipse.jgit.errors.StopWalkException; | |||
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 abstract class CommitTimeRevFilter extends RevFilter { | |||
when = (int) (ts / 1000); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevFilter clone() { | |||
return this; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean requiresCommitBody() { | |||
return false; |
@@ -50,7 +50,9 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
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. |
@@ -79,6 +79,7 @@ public class MaxCountRevFilter extends RevFilter { | |||
this.maxCount = maxCount; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean include(RevWalk walker, RevCommit cmit) | |||
throws StopWalkException, MissingObjectException, | |||
@@ -89,6 +90,7 @@ public class MaxCountRevFilter extends RevFilter { | |||
return true; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevFilter clone() { | |||
return new MaxCountRevFilter(maxCount); |
@@ -50,7 +50,9 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
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. |
@@ -50,7 +50,9 @@ import org.eclipse.jgit.errors.MissingObjectException; | |||
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 @@ public class NotRevFilter extends RevFilter { | |||
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 class NotRevFilter extends RevFilter { | |||
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$ |
@@ -54,7 +54,8 @@ import org.eclipse.jgit.revwalk.ObjectWalk; | |||
* 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 abstract class ObjectFilter { | |||
* @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. | |||
*/ |
@@ -57,9 +57,10 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
* 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 { | |||
/** |
@@ -56,7 +56,9 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
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 @@ public abstract class PatternMatchRevFilter extends RevFilter { | |||
* 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 abstract class PatternMatchRevFilter extends RevFilter { | |||
return patternText; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean include(final RevWalk walker, final RevCommit cmit) | |||
throws MissingObjectException, IncorrectObjectTypeException, | |||
@@ -131,6 +135,7 @@ public abstract class PatternMatchRevFilter extends RevFilter { | |||
return compiledPattern.reset(text(cmit)).matches(); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean requiresCommitBody() { | |||
return true; | |||
@@ -145,6 +150,7 @@ public abstract class PatternMatchRevFilter extends RevFilter { | |||
*/ | |||
protected abstract CharSequence text(RevCommit cmit); | |||
/** {@inheritDoc} */ | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { |
@@ -61,7 +61,8 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
* <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 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
* <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 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
* <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 abstract class RevFilter { | |||
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 abstract class RevFilter { | |||
* 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 class RevFilter { | |||
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(); |
@@ -52,7 +52,9 @@ import org.eclipse.jgit.revwalk.RevFlag; | |||
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 abstract class RevFlagFilter extends RevFilter { | |||
flags = m; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevFilter clone() { | |||
return this; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public String toString() { | |||
return super.toString() + flags; |
@@ -78,6 +78,7 @@ public class SkipRevFilter extends RevFilter { | |||
this.skip = skip; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean include(RevWalk walker, RevCommit cmit) | |||
throws StopWalkException, MissingObjectException, | |||
@@ -87,6 +88,7 @@ public class SkipRevFilter extends RevFilter { | |||
return true; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public RevFilter clone() { | |||
return new SkipRevFilter(skip); |
@@ -52,7 +52,9 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
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 @@ public abstract class SubStringRevFilter extends RevFilter { | |||
pattern = new RawSubStringPattern(patternText); | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean include(final RevWalk walker, final RevCommit cmit) | |||
throws MissingObjectException, IncorrectObjectTypeException, | |||
@@ -104,6 +108,7 @@ public abstract class SubStringRevFilter extends RevFilter { | |||
return pattern.match(text(cmit)) >= 0; | |||
} | |||
/** {@inheritDoc} */ | |||
@Override | |||
public boolean requiresCommitBody() { | |||
return true; | |||
@@ -118,11 +123,13 @@ public abstract class SubStringRevFilter extends RevFilter { | |||
*/ | |||
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() { |