Unlike RevWalk this subclass is able to remember starting roots that include
annotated tags, or arbitrary trees or blobs. Once commit generation is
complete and all commits have been popped by the application, individual
annotated tag, tree and blob objects can be popped through the additional
method nextObject().
Tree and blob objects reachable from interesting commits are automatically
scheduled for inclusion in the results of nextObject(), returning
each object exactly once. Objects are sorted and returned according to the
commits that reference them and the order they appear within a tree.
Ordering can be affected by changing the
org. used to order the commits that are
returned first.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static interface | ObjectWalk.
When walking over a tree and blob graph, objects are usually marked as seen as they are visited and this "seen" status is checked upon the next visit. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private ObjectWalk. | |
| private ObjectWalk. | |
| private static final int | |
| private static final int | IN_PENDING
Indicates a non-RevCommit is in |
| private ObjectFilter | |
| private byte[] | |
| private int | |
| private BlockObjQueue | |
| private List | |
| public static final ObjectWalk. | SIMPLE_VISITATION_POLICY
The default visitation policy: causes all objects to be visited exactly once. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private ObjectWalk. |
| Access | Constructor and Description |
|---|---|
| public | ObjectWalk(Repository
the repository the walker will obtain data from. repo)Create a new revision and object walker for a given repository. |
| public | ObjectWalk(ObjectReader
the reader the walker will obtain data from. The reader should
be released by the caller when the walker is no longer
required. or)Create a new revision and object walker for a given repository. |
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | |
| public void | dispose()
Overrides org. Dispose all internal state and invalidate all RevObject instances. |
| private static int | |
| public ObjectFilter | Returns: the current filter. Never null as a filter is always needed.Get the currently configured object filter. |
| public byte[] | Returns: the internal buffer holding the current path.Get the internal buffer holding the current path. |
| public int | Returns: path hash code; any integer may be returned.Get the current object's path hash code. |
| public int | Returns: length of the path ingetPathBuffer().Get length of the path in |
| public String | Returns: complete path of the current entry, from the root of the repository. If the current entry is in a subtree there will be at least one '/' in the returned string. Null if the current entry has no path, such as for annotated tags or root level trees.Get the current object's complete path. |
| public int | Returns: the current traversal depth from the root tree objectGet the current traversal depth from the root tree object |
| private void | |
| public void | |
| private void | |
| public void | markUninteresting(RevObject
the object to start traversing from. The object passed must be o)Mark an object to not produce in the output. |
| public RevCommit | |
| public RevObject | Returns: next most recent object; null if traversal is over.Pop the next most recent object. |
| private static int | |
| private RevObject | |
| private void | |
| protected void | reset(int
application flags that should not be cleared from
existing commit objects. retainFlags)Overrides org. Resets internal state and allows this instance to be used again. |
| public void | setObjectFilter(ObjectFilter
the new filter. If null the special
newFilter)org.
filter will be used instead, as it matches every object.Set the object filter for this walker. |
| public void | setVisitationPolicy(ObjectWalk.
the policyVisitationPolicy to useSets the visitation policy to use during this walk. |
| public void | |
| public void | sort(RevSort
a sorting strategy to enable. s)Overrides org. Select a single sorting strategy for the returned commits. |
| public void | sort(RevSort
a sorting strategy to enable or disable. s, boolean true if this strategy should be used, false if it should be
removed. use)Overrides org. Add or remove a sorting strategy for the returned commits. |
| private int |
| boundary | back to summary |
|---|---|
| private boolean boundary | |
| currVisit | back to summary |
|---|---|
| private ObjectWalk. | |
| freeVisit | back to summary |
|---|---|
| private ObjectWalk. | |
| ID_SZ | back to summary |
|---|---|
| private static final int ID_SZ | |
| IN_PENDING | back to summary |
|---|---|
| private static final int IN_PENDING Indicates a non-RevCommit is in
We can safely reuse | |
| objectFilter | back to summary |
|---|---|
| private ObjectFilter objectFilter | |
| pathBuf | back to summary |
|---|---|
| private byte[] pathBuf | |
| pathLen | back to summary |
|---|---|
| private int pathLen | |
| pendingObjects | back to summary |
|---|---|
| private BlockObjQueue pendingObjects | |
| rootObjects | back to summary |
|---|---|
| private List<RevObject> rootObjects | |
| SIMPLE_VISITATION_POLICY | back to summary |
|---|---|
| public static final ObjectWalk. The default visitation policy: causes all objects to be visited exactly once.
| |
| TYPE_FILE | back to summary |
|---|---|
| private static final int TYPE_FILE | |
| TYPE_GITLINK | back to summary |
|---|---|
| private static final int TYPE_GITLINK | |
| TYPE_SHIFT | back to summary |
|---|---|
| private static final int TYPE_SHIFT | |
| TYPE_SYMLINK | back to summary |
|---|---|
| private static final int TYPE_SYMLINK | |
| TYPE_TREE | back to summary |
|---|---|
| private static final int TYPE_TREE | |
| visitationPolicy | back to summary |
|---|---|
| private ObjectWalk. | |
| ObjectWalk | back to summary |
|---|---|
| public ObjectWalk(Repository repo) Create a new revision and object walker for a given repository.
| |
| ObjectWalk | back to summary |
|---|---|
| public ObjectWalk(ObjectReader or) Create a new revision and object walker for a given repository.
| |
| ObjectWalk | back to summary |
|---|---|
| private ObjectWalk(ObjectReader or, boolean closeReader) | |
| addObject | back to summary |
|---|---|
| private void addObject(RevObject o) | |
| checkConnectivity | back to summary |
|---|---|
| public void checkConnectivity() throws MissingObjectException, IncorrectObjectTypeException, IOException Verify all interesting objects are available, and reachable.
Callers should populate starting points and ending points with
This method returns successfully if everything is connected; it throws an exception if there is a connectivity problem. The exception message provides some detail about the connectivity failure.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides org. Doc from org. Dispose all internal state and invalidate all RevObject instances. All RevObject (and thus RevCommit, etc.) instances previously acquired from this RevWalk are invalidated by a dispose call. Applications must not retain or use RevObject instances obtained prior to the dispose call. All RevFlag instances are also invalidated, and must not be reused.
| |
| findObjectId | back to summary |
|---|---|
| private static int findObjectId(byte[] buf, int ptr) | |
| getObjectFilter | back to summary |
|---|---|
| public ObjectFilter getObjectFilter() Get the currently configured object filter.
| |
| getPathBuffer | back to summary |
|---|---|
| public byte[] getPathBuffer() Get the internal buffer holding the current path.
| |
| getPathHashCode | back to summary |
|---|---|
| public int getPathHashCode() Get the current object's path hash code. This method computes a hash code on the fly for this path, the hash is suitable to cluster objects that may have similar paths together.
| |
| getPathLength | back to summary |
|---|---|
| public int getPathLength() Get length of the path in
| |
| getPathString | back to summary |
|---|---|
| public String getPathString() Get the current object's complete path. This method is not very efficient and is primarily meant for debugging and final output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function.
| |
| getTreeDepth | back to summary |
|---|---|
| public int getTreeDepth() Get the current traversal depth from the root tree object
| |
| growPathBuf | back to summary |
|---|---|
| private void growPathBuf(int ptr) | |
| markStart | back to summary |
|---|---|
| public void markStart(RevObject o) throws MissingObjectException, IncorrectObjectTypeException, IOException Mark an object or commit to start graph traversal from.
Callers are encouraged to use
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.
This method will automatically call
| |
| markTreeUninteresting | back to summary |
|---|---|
| private void markTreeUninteresting(RevTree tree) throws MissingObjectException, IncorrectObjectTypeException, IOException | |
| markUninteresting | back to summary |
|---|---|
| public void markUninteresting(RevObject o) throws MissingObjectException, IncorrectObjectTypeException, IOException Mark an object to not produce in the output. Uninteresting objects denote not just themselves but also their entire reachable chain, back until the merge base of an uninteresting commit and an otherwise interesting commit.
Callers are encouraged to use
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.
This method will automatically call
| |
| next | back to summary |
|---|---|
| public RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException Overrides org. Doc from org. Pop the next most recent commit.
| |
| nextObject | back to summary |
|---|---|
| public RevObject nextObject() throws MissingObjectException, IncorrectObjectTypeException, IOException Pop the next most recent object.
| |
| parseMode | back to summary |
|---|---|
| private static int parseMode(byte[] buf, int startPtr, int recEndPtr, ObjectWalk. | |
| pushTree | back to summary |
|---|---|
| private RevObject pushTree(RevObject obj) throws LargeObjectException, MissingObjectException, IncorrectObjectTypeException, IOException | |
| releaseTreeVisit | back to summary |
|---|---|
| private void releaseTreeVisit(ObjectWalk. | |
| reset | back to summary |
|---|---|
| protected void reset(int retainFlags) Overrides org. Doc from org. Resets internal state and allows this instance to be used again.
Unlike
| |
| setObjectFilter | back to summary |
|---|---|
| public void setObjectFilter(ObjectFilter newFilter) Set the object filter for this walker. This filter affects the objects
visited by 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. This can be used to speed up the object walk by skipping subtrees that are known to be uninteresting.
| |
| setVisitationPolicy | back to summary |
|---|---|
| public void setVisitationPolicy(ObjectWalk. Sets the visitation policy to use during this walk.
| |
| skipTree | back to summary |
|---|---|
| public void skipTree() Skips the current tree such that
| |
| sort | back to summary |
|---|---|
| public void sort(RevSort s) Overrides org. Doc from org. Select a single sorting strategy for the returned commits. Disables all sorting strategies, then enables only the single strategy supplied by the caller. | |
| sort | back to summary |
|---|---|
| public void sort(RevSort s, boolean use) Overrides org. Doc from org. Add or remove a sorting strategy for the returned commits.
Multiple strategies can be applied at once, in which case some strategies
may take precedence over others. As an example,
| |
| updatePathBuf | back to summary |
|---|---|
| private int updatePathBuf(ObjectWalk. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv byte[] | |
| pack-priv int | depth
Number of levels deep from the root tree. |
| pack-priv int | nameEnd
One past end of name, |
| pack-priv int | |
| pack-priv RevObject | obj
The RevTree currently being iterated through. |
| pack-priv ObjectWalk. | parent
Parent tree visit that entered this tree, null if root tree. |
| pack-priv int | pathLen
Number of bytes in the path leading up to this tree. |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| private |
| buf | back to summary |
|---|---|
| pack-priv byte[] buf Canonical encoding of the tree named by | |
| depth | back to summary |
|---|---|
| pack-priv int depth Number of levels deep from the root tree. 0 for root tree. | |
| nameEnd | back to summary |
|---|---|
| pack-priv int nameEnd One past end of name, | |
| namePtr | back to summary |
|---|---|
| pack-priv int namePtr Start of the current name entry in | |
| obj | back to summary |
|---|---|
| pack-priv RevObject obj The RevTree currently being iterated through. | |
| parent | back to summary |
|---|---|
| pack-priv ObjectWalk. Parent tree visit that entered this tree, null if root tree. | |
| pathLen | back to summary |
|---|---|
| pack-priv int pathLen Number of bytes in the path leading up to this tree. | |
| ptr | back to summary |
|---|---|
| pack-priv int ptr Index of next entry to parse in | |
| TreeVisit | back to summary |
|---|---|
| private TreeVisit() | |
ObjectWalk#nextObject()) again. However, this behavior can be
overridden by supplying a different implementation of this class.
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the object should be visitedthe object to check if it should be visited o)Whenever the rev or object walk reaches a Git object, if that object already exists as a RevObject, this method is called to determine if that object should be visited. |
| public void |
| shouldVisit | back to summary |
|---|---|
| public boolean shouldVisit(RevObject o) Whenever the rev or object walk reaches a Git object, if that object already exists as a RevObject, this method is called to determine if that object should be visited.
| |
| visited | back to summary |
|---|---|
| public void visited(RevObject o) Called when an object is visited.
| |