org.eclipse.jgit.treewalk.AbstractTreeIterator s in
parallel.
This class can perform n-way differences across as many trees as necessary.
Each tree added must have the same root as existing trees in the walk.
A TreeWalk instance can only be used once to generate results. Running a
second time requires creating a new TreeWalk instance, or invoking
reset() and adding new trees before starting again. Resetting an
existing instance may be faster for some applications as some internal
buffers may be recycled.
TreeWalk instances are not thread-safe. Applications must either restrict usage of a TreeWalk instance to a single thread, or implement their own synchronization at a higher level.
Multiple simultaneous TreeWalk instances per
org. are permitted, even from concurrent
threads.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | TreeWalk.
Type of operation to retrieve git attributes for. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private AttributesHandler[] | attributesHandlers
Cached attributes handler; per tree. |
| private AttributesNodeProvider | |
| private Attributes[] | attrs
Cached attributes for the current entry; per tree. |
| private final boolean | |
| private Config | |
| pack-priv AbstractTreeIterator | |
| pack-priv int | |
| private TreeFilter | |
| private Set | |
| private Map | filterCommandsByNameDotType
The filter command as defined in gitattributes. |
| private int | headIndex
Can be set to identify the tree to use for |
| private final MutableObjectId | |
| private static final AbstractTreeIterator[] | |
| private TreeWalk. | operationType
Type of operation you want to retrieve the git attributes for. |
| private boolean | |
| private boolean | |
| private final ObjectReader | |
| private boolean | |
| pack-priv AbstractTreeIterator[] |
| Access | Constructor and Description |
|---|---|
| public | TreeWalk(Repository
the repository the walker will obtain data from. An
ObjectReader will be created by the walker, and will be closed
when the walker is closed. repo)Create a new tree walker for a given repository. |
| public | TreeWalk(Repository
the repository the walker will obtain data from. An
ObjectReader will be created by the walker, and will be closed
when the walker is closed. repo, ObjectReader the reader the walker will obtain tree data from. The reader
is not closed when the walker is closed. or)Create a new tree walker for a given repository. |
| public | TreeWalk(ObjectReader
the reader the walker will obtain tree data from. The reader
is not closed when the walker is closed. or)Create a new tree walker for a given repository. |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: position of this tree within the walker.identity of the tree object the caller wants walked. id)Add an already existing tree object for walking. |
| public int | Returns: position of this tree within the walker.an iterator to walk over. The iterator should be new, with no
parent, and should still be positioned before the first entry.
The tree which the iterator operates on must have the same
root as other trees in the walk. p)Add an already created tree iterator for walking. |
| public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| public void | |
| pack-priv void | |
| public static TreeWalk | Returns: a new tree walk configured for exactly this one path; null if no path was found in any of the trees.the reader the walker will obtain tree data from. reader, final String single path to advance the tree walk instance into. path, final AnyObjectId... one or more trees to walk through, all with the same root. trees)Open a tree walk and filter to exactly one path. |
| public static TreeWalk | Returns: a new tree walk configured for exactly this one path; null if no path was found in any of the trees.repository to read config data and
repo, final ObjectReader org.
from.the reader the walker will obtain tree data from. reader, final String single path to advance the tree walk instance into. path, final AnyObjectId... one or more trees to walk through, all with the same root. trees)Open a tree walk and filter to exactly one path. |
| public static TreeWalk | Returns: a new tree walk configured for exactly this one path; null if no path was found in any of the trees.repository to read tree object data from. db, final String single path to advance the tree walk instance into. path, final AnyObjectId... one or more trees to walk through, all with the same root. trees)Open a tree walk and filter to exactly one path. |
| public static TreeWalk | Returns: a new tree walk configured for exactly this one path; null if no path was found in any of the trees.repository to read tree object data from. db, final String single path to advance the tree walk instance into. path, final RevTree the single tree to walk through. tree)Open a tree walk and filter to exactly one path. |
| public Attributes | getAttributes()
Implements org. Get attributes Retrieve the git attributes for the current entry. |
| public Attributes | Returns: the attributesof the tree to use as base for the attributes index)Retrieves the git attributes based on the given tree. |
| public AttributesNodeProvider | Returns: theorg.
for this org..Get the attributes node provider |
| public CoreConfig. | Returns: the EOL stream type of the current entry using the config andgetAttributes(). Note that this method may return null
if the org. is not based on
a working treeindex of the tree the check-out is to be from tree)Get the EOL stream type of the current entry for checking out using the
config and |
| public int | Returns: the current subtree depth of this walker.Get the current subtree depth of this walker. |
| public CoreConfig. | Returns: the EOL stream type of the current entry using the config andgetAttributes(). Note that this method may return null
if the org. is not based on
a working treethe operationtype (checkin/checkout) which should be used opTypeGet the EOL stream type of the current entry using the config and
|
| public FileMode | Returns: mode for the current entry of the nth tree.tree to obtain the mode from. nth)Obtain the |
| public FileMode | Returns: mode for the current entry of the currentHead tree.Obtain the |
| public TreeFilter | Returns: the current filter. Never null as a filter is always needed.Get the currently configured filter. |
| public String | Returns: a filter commandwhich type of filterCommand should be executed. E.g. "clean",
"smudge". For "smudge" consider using
{ filterCommandType)getSmudgeCommand(int) instead.Inspect config and attributes to return a filtercommand applicable for the current path. |
| private String | Returns: the definition of the command to be executed for this filter driver and filter commandThe name of the filter driver as it is referenced in the
gitattributes file. E.g. "lfs". For each filter driver there
may be many commands defined in the .gitconfig filterDriverName, String The type of the filter command for a specific filter driver.
May be "clean" or "smudge". filterCommandType)Get the filter command how it is defined in gitconfig. |
| public String | Returns: name of the current entry within the parent tree (or directory). The name never includes a '/'.Get the current entry's name within its parent tree. |
| public ObjectId | Returns: object identifier for the current tree entry.tree to obtain the object identifier from. nth)Obtain the ObjectId for the current entry. |
| public void | getObjectId(MutableObjectId
buffer to copy the object id into. out, int tree to obtain the object identifier from. nth)Obtain the ObjectId for the current entry. |
| public ObjectReader | Returns: the reader this walker is using to load objects.Get the reader this walker is using to load objects. |
| public TreeWalk. | Returns: theorg.Get the operation type |
| public int | Returns: The path length of the current entry.Get the path length of the current entry. |
| 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.Get the current entry's complete path. |
| public int | Returns: mode bits for the current entry of the nth tree.tree to obtain the mode bits from. nth)Obtain the raw |
| public byte[] | 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.Get the current entry's complete path as a UTF-8 byte array. |
| public String | Returns: a filter commandof the tree the item to be smudged is in index)Inspect config and attributes to return a filtercommand applicable for the current path. |
| public String | Returns: a filter commandto use attributes)Inspect config and attributes to return a filtercommand applicable for the current path. |
| public < Type of returned T extends AbstractTreeIterator> TAbstractTreeIterator | |
| public < a tree type. T extends AbstractTreeIterator> T | |
| public int | Returns: the total number of trees this walker is iterating over.Get the number of trees known to this walker. |
| public boolean | Returns: result ofgetObjectId(nthA).equals(getObjectId(nthB)).first tree to compare the object id from. nthA, int second tree to compare the object id from. nthB)Compare two tree's current ObjectId values for equality. |
| public int | Returns: -1 if the current path is a parent to p; 0 if p matches the current path; 1 if the current path is different and will never match again on this tree walk.path buffer to test. Callers should ensure the path does not
end with '/' prior to invocation. p, int number of bytes from pLen)buf to test.Test if the supplied path matches the current entry's path. |
| public int | Returns: < 0 if p is before the current path; 0 if p matches the current path; 1 if the current path is past p and p will never match again on this tree walk.path buffer to test. Callers should ensure the path does not
end with '/' prior to invocation. p, int number of bytes from pLen)buf to test.Test if the supplied path matches the current entry's path. |
| public boolean | Returns: true if p is suffix of the current path; false if otherwisepath buffer to test. p, int number of bytes from pLen)buf to test.Test if the supplied path matches (being suffix of) the current entry's path. |
| public boolean | Returns: true if the current node is a tree that has been returned after its children were already processed.Is the current entry a subtree returned after its children? |
| public boolean | Returns: true if subtrees are returned after entries within the subtree.Does this walker return a tree entry after it exits the subtree? |
| public boolean | Returns: true if automatically entering subtrees is enabled.Is this walker automatically entering into subtrees? |
| public boolean | Returns: true ifenterSubtree() will work on the current node.Is the current entry a subtree? |
| pack-priv AbstractTreeIterator | Returns: the smallest tree iterator available.Returns an AbstractTreeIterator from |
| public boolean | Returns: true if there is an entry available; false if all entries have been walked and the walk of this set of tree iterators is over.Advance this walker to the next relevant entry. |
| private CanonicalTreeParser | |
| pack-priv static String | |
| pack-priv static String | |
| pack-priv void | |
| public void | |
| public void | reset(AnyObjectId
the tree we need to parse. The walker will execute over this
single tree if the reset is successful. id)Reset this walker to run over a single existing tree. |
| public void | reset(AnyObjectId...
the trees we need to parse. The walker will execute over this
many parallel trees if the reset is successful. ids)Reset this walker to run over a set of existing trees. |
| public void | |
| public void | setFilter(TreeFilter
the new filter. If null the special
newFilter)org. filter
will be used instead, as it matches every entry.Set the tree entry filter for this walker. |
| public void | setHead(int
of the tree to use as head index)Identifies the tree at the given index as the head tree. |
| public void | |
| public void | setPostOrderTraversal(boolean
true to get trees after their children. b)Set the walker to return trees after their children. |
| public void | setRecursive(boolean
true to skip subtree nodes and only obtain files nodes. b)Set the walker to enter (or not enter) subtrees automatically. |
| pack-priv void | |
| pack-priv void |