|
|
@ -81,7 +81,8 @@ import org.eclipse.jgit.util.RawParseUtils; |
|
|
|
import org.eclipse.jgit.util.io.EolStreamTypeUtil; |
|
|
|
import org.eclipse.jgit.util.io.EolStreamTypeUtil; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Walks one or more {@link AbstractTreeIterator}s in parallel. |
|
|
|
* Walks one or more {@link org.eclipse.jgit.treewalk.AbstractTreeIterator}s in |
|
|
|
|
|
|
|
* parallel. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* This class can perform n-way differences across as many trees as necessary. |
|
|
|
* This class can perform n-way differences across as many trees as necessary. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -97,8 +98,9 @@ import org.eclipse.jgit.util.io.EolStreamTypeUtil; |
|
|
|
* usage of a TreeWalk instance to a single thread, or implement their own |
|
|
|
* usage of a TreeWalk instance to a single thread, or implement their own |
|
|
|
* synchronization at a higher level. |
|
|
|
* synchronization at a higher level. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Multiple simultaneous TreeWalk instances per {@link Repository} are |
|
|
|
* Multiple simultaneous TreeWalk instances per |
|
|
|
* permitted, even from concurrent threads. |
|
|
|
* {@link org.eclipse.jgit.lib.Repository} are permitted, even from concurrent |
|
|
|
|
|
|
|
* threads. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
private static final AbstractTreeIterator[] NO_TREES = {}; |
|
|
|
private static final AbstractTreeIterator[] NO_TREES = {}; |
|
|
@ -131,7 +133,11 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
private Map<String, String> filterCommandsByNameDotType = new HashMap<>(); |
|
|
|
private Map<String, String> filterCommandsByNameDotType = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* Set the operation type of this walk |
|
|
|
|
|
|
|
* |
|
|
|
* @param operationType |
|
|
|
* @param operationType |
|
|
|
|
|
|
|
* a {@link org.eclipse.jgit.treewalk.TreeWalk.OperationType} |
|
|
|
|
|
|
|
* object. |
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setOperationType(OperationType operationType) { |
|
|
|
public void setOperationType(OperationType operationType) { |
|
|
@ -153,14 +159,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* one or more trees to walk through, all with the same root. |
|
|
|
* one or more trees to walk through, all with the same root. |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* path was found in any of the trees. |
|
|
|
* path was found in any of the trees. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* a tree object was not found. |
|
|
|
* a tree object was not found. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static TreeWalk forPath(final ObjectReader reader, final String path, |
|
|
|
public static TreeWalk forPath(final ObjectReader reader, final String path, |
|
|
@ -178,7 +184,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param repo |
|
|
|
* @param repo |
|
|
|
* repository to read config data and |
|
|
|
* repository to read config data and |
|
|
|
* {@link AttributesNodeProvider} from. |
|
|
|
* {@link org.eclipse.jgit.attributes.AttributesNodeProvider} |
|
|
|
|
|
|
|
* from. |
|
|
|
* @param reader |
|
|
|
* @param reader |
|
|
|
* the reader the walker will obtain tree data from. |
|
|
|
* the reader the walker will obtain tree data from. |
|
|
|
* @param path |
|
|
|
* @param path |
|
|
@ -187,14 +194,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* one or more trees to walk through, all with the same root. |
|
|
|
* one or more trees to walk through, all with the same root. |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* path was found in any of the trees. |
|
|
|
* path was found in any of the trees. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* a tree object was not found. |
|
|
|
* a tree object was not found. |
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -234,14 +241,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* one or more trees to walk through, all with the same root. |
|
|
|
* one or more trees to walk through, all with the same root. |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* path was found in any of the trees. |
|
|
|
* path was found in any of the trees. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* a tree object was not found. |
|
|
|
* a tree object was not found. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static TreeWalk forPath(final Repository db, final String path, |
|
|
|
public static TreeWalk forPath(final Repository db, final String path, |
|
|
@ -267,14 +274,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* the single tree to walk through. |
|
|
|
* the single tree to walk through. |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* @return a new tree walk configured for exactly this one path; null if no |
|
|
|
* path was found in any of the trees. |
|
|
|
* path was found in any of the trees. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* reading a pack file or loose object failed. |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* an tree object could not be read as its data stream did not |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* appear to be a tree, or could not be inflated. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* an object we expected to be a tree was not a tree. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* a tree object was not found. |
|
|
|
* a tree object was not found. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static TreeWalk forPath(final Repository db, final String path, |
|
|
|
public static TreeWalk forPath(final Repository db, final String path, |
|
|
@ -373,13 +380,19 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
this.closeReader = closeReader; |
|
|
|
this.closeReader = closeReader; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** @return the reader this walker is using to load objects. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* Get the reader this walker is using to load objects. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return the reader this walker is using to load objects. |
|
|
|
|
|
|
|
*/ |
|
|
|
public ObjectReader getObjectReader() { |
|
|
|
public ObjectReader getObjectReader() { |
|
|
|
return reader; |
|
|
|
return reader; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return the {@link OperationType} |
|
|
|
* Get the operation type |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return the {@link org.eclipse.jgit.treewalk.TreeWalk.OperationType} |
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public OperationType getOperationType() { |
|
|
|
public OperationType getOperationType() { |
|
|
@ -387,6 +400,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
* <p> |
|
|
|
* Release any resources used by this walker's reader. |
|
|
|
* Release any resources used by this walker's reader. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* A walker that has been released can be used again, but may need to be |
|
|
|
* A walker that has been released can be used again, but may need to be |
|
|
@ -421,12 +436,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* Note that filters are not thread-safe and may not be shared by concurrent |
|
|
|
* Note that filters are not thread-safe and may not be shared by concurrent |
|
|
|
* TreeWalk instances. Every TreeWalk must be supplied its own unique |
|
|
|
* TreeWalk instances. Every TreeWalk must be supplied its own unique |
|
|
|
* filter, unless the filter implementation specifically states it is (and |
|
|
|
* filter, unless the filter implementation specifically states it is (and |
|
|
|
* always will be) thread-safe. Callers may use {@link TreeFilter#clone()} |
|
|
|
* always will be) thread-safe. Callers may use |
|
|
|
* to create a unique filter tree for this TreeWalk instance. |
|
|
|
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#clone()} to create a |
|
|
|
|
|
|
|
* unique filter tree for this TreeWalk instance. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param newFilter |
|
|
|
* @param newFilter |
|
|
|
* the new filter. If null the special {@link TreeFilter#ALL} |
|
|
|
* the new filter. If null the special |
|
|
|
* filter will be used instead, as it matches every entry. |
|
|
|
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} filter |
|
|
|
|
|
|
|
* will be used instead, as it matches every entry. |
|
|
|
* @see org.eclipse.jgit.treewalk.filter.AndTreeFilter |
|
|
|
* @see org.eclipse.jgit.treewalk.filter.AndTreeFilter |
|
|
|
* @see org.eclipse.jgit.treewalk.filter.OrTreeFilter |
|
|
|
* @see org.eclipse.jgit.treewalk.filter.OrTreeFilter |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -493,19 +510,23 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets the {@link AttributesNodeProvider} for this {@link TreeWalk}. |
|
|
|
* Sets the {@link org.eclipse.jgit.attributes.AttributesNodeProvider} for |
|
|
|
|
|
|
|
* this {@link org.eclipse.jgit.treewalk.TreeWalk}. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* This is a requirement for a correct computation of the git attributes. |
|
|
|
* This is a requirement for a correct computation of the git attributes. If |
|
|
|
* If this {@link TreeWalk} has been built using |
|
|
|
* this {@link org.eclipse.jgit.treewalk.TreeWalk} has been built using |
|
|
|
* {@link #TreeWalk(Repository)} constructor, the |
|
|
|
* {@link #TreeWalk(Repository)} constructor, the |
|
|
|
* {@link AttributesNodeProvider} has already been set. Indeed,the |
|
|
|
* {@link org.eclipse.jgit.attributes.AttributesNodeProvider} has already |
|
|
|
* {@link Repository} can provide an {@link AttributesNodeProvider} using |
|
|
|
* been set. Indeed,the {@link org.eclipse.jgit.lib.Repository} can provide |
|
|
|
* {@link Repository#createAttributesNodeProvider()} method. Otherwise you |
|
|
|
* an {@link org.eclipse.jgit.attributes.AttributesNodeProvider} using |
|
|
|
* should provide one. |
|
|
|
* {@link org.eclipse.jgit.lib.Repository#createAttributesNodeProvider()} |
|
|
|
|
|
|
|
* method. Otherwise you should provide one. |
|
|
|
* </p> |
|
|
|
* </p> |
|
|
|
* |
|
|
|
* |
|
|
|
* @see Repository#createAttributesNodeProvider() |
|
|
|
* @see Repository#createAttributesNodeProvider() |
|
|
|
* @param provider |
|
|
|
* @param provider |
|
|
|
|
|
|
|
* a {@link org.eclipse.jgit.attributes.AttributesNodeProvider} |
|
|
|
|
|
|
|
* object. |
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setAttributesNodeProvider(AttributesNodeProvider provider) { |
|
|
|
public void setAttributesNodeProvider(AttributesNodeProvider provider) { |
|
|
@ -513,7 +534,10 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return the {@link AttributesNodeProvider} for this {@link TreeWalk}. |
|
|
|
* Get the attributes node provider |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return the {@link org.eclipse.jgit.attributes.AttributesNodeProvider} |
|
|
|
|
|
|
|
* for this {@link org.eclipse.jgit.treewalk.TreeWalk}. |
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public AttributesNodeProvider getAttributesNodeProvider() { |
|
|
|
public AttributesNodeProvider getAttributesNodeProvider() { |
|
|
@ -521,6 +545,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
* <p> |
|
|
|
* Retrieve the git attributes for the current entry. |
|
|
|
* Retrieve the git attributes for the current entry. |
|
|
|
* |
|
|
|
* |
|
|
|
* <h4>Git attribute computation</h4> |
|
|
|
* <h4>Git attribute computation</h4> |
|
|
@ -556,7 +582,6 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* provided it will fallback on the {@link DirCacheIterator}. |
|
|
|
* provided it will fallback on the {@link DirCacheIterator}. |
|
|
|
* </p> |
|
|
|
* </p> |
|
|
|
* |
|
|
|
* |
|
|
|
* @return a {@link Set} of {@link Attribute}s that match the current entry. |
|
|
|
|
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -587,11 +612,15 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* Get the EOL stream type of the current entry using the config and |
|
|
|
|
|
|
|
* {@link #getAttributes()}. |
|
|
|
|
|
|
|
* |
|
|
|
* @param opType |
|
|
|
* @param opType |
|
|
|
* the operationtype (checkin/checkout) which should be used |
|
|
|
* the operationtype (checkin/checkout) which should be used |
|
|
|
* @return the EOL stream type of the current entry using the config and |
|
|
|
* @return the EOL stream type of the current entry using the config and |
|
|
|
* {@link #getAttributes()} Note that this method may return null if |
|
|
|
* {@link #getAttributes()}. Note that this method may return null |
|
|
|
* the {@link TreeWalk} is not based on a working tree |
|
|
|
* if the {@link org.eclipse.jgit.treewalk.TreeWalk} is not based on |
|
|
|
|
|
|
|
* a working tree |
|
|
|
* @since 4.10 |
|
|
|
* @since 4.10 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
@ -604,9 +633,13 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* Get the EOL stream type of the current entry using the config and |
|
|
|
|
|
|
|
* {@link #getAttributes()}. |
|
|
|
|
|
|
|
* |
|
|
|
* @return the EOL stream type of the current entry using the config and |
|
|
|
* @return the EOL stream type of the current entry using the config and |
|
|
|
* {@link #getAttributes()} Note that this method may return null if |
|
|
|
* {@link #getAttributes()}. Note that this method may return null |
|
|
|
* the {@link TreeWalk} is not based on a working tree |
|
|
|
* if the {@link org.eclipse.jgit.treewalk.TreeWalk} is not based on |
|
|
|
|
|
|
|
* a working tree |
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
|
* @deprecated use {@link #getEolStreamType(OperationType)} instead. |
|
|
|
* @deprecated use {@link #getEolStreamType(OperationType)} instead. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -615,7 +648,9 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
return (getEolStreamType(operationType)); |
|
|
|
return (getEolStreamType(operationType)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Reset this walker so new tree iterators can be added to it. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* Reset this walker so new tree iterators can be added to it. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void reset() { |
|
|
|
public void reset() { |
|
|
|
attrs = null; |
|
|
|
attrs = null; |
|
|
|
attributesHandler = null; |
|
|
|
attributesHandler = null; |
|
|
@ -630,16 +665,16 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* @param id |
|
|
|
* @param id |
|
|
|
* the tree we need to parse. The walker will execute over this |
|
|
|
* the tree we need to parse. The walker will execute over this |
|
|
|
* single tree if the reset is successful. |
|
|
|
* single tree if the reset is successful. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* the given tree object does not exist in this repository. |
|
|
|
* the given tree object does not exist in this repository. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* the given object id does not denote a tree, but instead names |
|
|
|
* the given object id does not denote a tree, but instead names |
|
|
|
* some other non-tree type of object. Note that commits are not |
|
|
|
* some other non-tree type of object. Note that commits are not |
|
|
|
* trees, even if they are sometimes called a "tree-ish". |
|
|
|
* trees, even if they are sometimes called a "tree-ish". |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* the object claimed to be a tree, but its contents did not |
|
|
|
* the object claimed to be a tree, but its contents did not |
|
|
|
* appear to be a tree. The repository may have data corruption. |
|
|
|
* appear to be a tree. The repository may have data corruption. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void reset(final AnyObjectId id) throws MissingObjectException, |
|
|
|
public void reset(final AnyObjectId id) throws MissingObjectException, |
|
|
@ -671,16 +706,16 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* @param ids |
|
|
|
* @param ids |
|
|
|
* the trees we need to parse. The walker will execute over this |
|
|
|
* the trees we need to parse. The walker will execute over this |
|
|
|
* many parallel trees if the reset is successful. |
|
|
|
* many parallel trees if the reset is successful. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* the given tree object does not exist in this repository. |
|
|
|
* the given tree object does not exist in this repository. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* the given object id does not denote a tree, but instead names |
|
|
|
* the given object id does not denote a tree, but instead names |
|
|
|
* some other non-tree type of object. Note that commits are not |
|
|
|
* some other non-tree type of object. Note that commits are not |
|
|
|
* trees, even if they are sometimes called a "tree-ish". |
|
|
|
* trees, even if they are sometimes called a "tree-ish". |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* the object claimed to be a tree, but its contents did not |
|
|
|
* the object claimed to be a tree, but its contents did not |
|
|
|
* appear to be a tree. The repository may have data corruption. |
|
|
|
* appear to be a tree. The repository may have data corruption. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void reset(final AnyObjectId... ids) throws MissingObjectException, |
|
|
|
public void reset(final AnyObjectId... ids) throws MissingObjectException, |
|
|
@ -726,16 +761,16 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* @param id |
|
|
|
* @param id |
|
|
|
* identity of the tree object the caller wants walked. |
|
|
|
* identity of the tree object the caller wants walked. |
|
|
|
* @return position of this tree within the walker. |
|
|
|
* @return position of this tree within the walker. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* the given tree object does not exist in this repository. |
|
|
|
* the given tree object does not exist in this repository. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* the given object id does not denote a tree, but instead names |
|
|
|
* the given object id does not denote a tree, but instead names |
|
|
|
* some other non-tree type of object. Note that commits are not |
|
|
|
* some other non-tree type of object. Note that commits are not |
|
|
|
* trees, even if they are sometimes called a "tree-ish". |
|
|
|
* trees, even if they are sometimes called a "tree-ish". |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* the object claimed to be a tree, but its contents did not |
|
|
|
* the object claimed to be a tree, but its contents did not |
|
|
|
* appear to be a tree. The repository may have data corruption. |
|
|
|
* appear to be a tree. The repository may have data corruption. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int addTree(final AnyObjectId id) throws MissingObjectException, |
|
|
|
public int addTree(final AnyObjectId id) throws MissingObjectException, |
|
|
@ -786,19 +821,19 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* |
|
|
|
* |
|
|
|
* @return true if there is an entry available; false if all entries have |
|
|
|
* @return 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. |
|
|
|
* been walked and the walk of this set of tree iterators is over. |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* {@link #isRecursive()} was enabled, a subtree was found, but |
|
|
|
* {@link #isRecursive()} was enabled, a subtree was found, but |
|
|
|
* the subtree object does not exist in this repository. The |
|
|
|
* the subtree object does not exist in this repository. The |
|
|
|
* repository may be missing objects. |
|
|
|
* repository may be missing objects. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* {@link #isRecursive()} was enabled, a subtree was found, and |
|
|
|
* {@link #isRecursive()} was enabled, a subtree was found, and |
|
|
|
* the subtree id does not denote a tree, but instead names some |
|
|
|
* the subtree id does not denote a tree, but instead names some |
|
|
|
* other non-tree type of object. The repository may have data |
|
|
|
* other non-tree type of object. The repository may have data |
|
|
|
* corruption. |
|
|
|
* corruption. |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* the contents of a tree did not appear to be a tree. The |
|
|
|
* the contents of a tree did not appear to be a tree. The |
|
|
|
* repository may have data corruption. |
|
|
|
* repository may have data corruption. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean next() throws MissingObjectException, |
|
|
|
public boolean next() throws MissingObjectException, |
|
|
@ -873,8 +908,6 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* iterators to manage only one list of items, with the diving handled by |
|
|
|
* iterators to manage only one list of items, with the diving handled by |
|
|
|
* recursive trees. |
|
|
|
* recursive trees. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param <T> |
|
|
|
|
|
|
|
* type of the tree iterator expected by the caller. |
|
|
|
|
|
|
|
* @param nth |
|
|
|
* @param nth |
|
|
|
* tree to obtain the current iterator of. |
|
|
|
* tree to obtain the current iterator of. |
|
|
|
* @param clazz |
|
|
|
* @param clazz |
|
|
@ -890,11 +923,13 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Obtain the raw {@link FileMode} bits for the current entry. |
|
|
|
* Obtain the raw {@link org.eclipse.jgit.lib.FileMode} bits for the current |
|
|
|
|
|
|
|
* entry. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Every added tree supplies mode bits, even if the tree does not contain |
|
|
|
* Every added tree supplies mode bits, even if the tree does not contain |
|
|
|
* the current entry. In the latter case {@link FileMode#MISSING}'s mode |
|
|
|
* the current entry. In the latter case |
|
|
|
* bits (0) are returned. |
|
|
|
* {@link org.eclipse.jgit.lib.FileMode#MISSING}'s mode bits (0) are |
|
|
|
|
|
|
|
* returned. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param nth |
|
|
|
* @param nth |
|
|
|
* tree to obtain the mode bits from. |
|
|
|
* tree to obtain the mode bits from. |
|
|
@ -907,10 +942,11 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Obtain the {@link FileMode} for the current entry. |
|
|
|
* Obtain the {@link org.eclipse.jgit.lib.FileMode} for the current entry. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Every added tree supplies a mode, even if the tree does not contain the |
|
|
|
* Every added tree supplies a mode, even if the tree does not contain the |
|
|
|
* current entry. In the latter case {@link FileMode#MISSING} is returned. |
|
|
|
* current entry. In the latter case |
|
|
|
|
|
|
|
* {@link org.eclipse.jgit.lib.FileMode#MISSING} is returned. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param nth |
|
|
|
* @param nth |
|
|
|
* tree to obtain the mode from. |
|
|
|
* tree to obtain the mode from. |
|
|
@ -921,7 +957,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Obtain the {@link FileMode} for the current entry on the currentHead tree |
|
|
|
* Obtain the {@link org.eclipse.jgit.lib.FileMode} for the current entry on |
|
|
|
|
|
|
|
* the currentHead tree |
|
|
|
* |
|
|
|
* |
|
|
|
* @return mode for the current entry of the currentHead tree. |
|
|
|
* @return mode for the current entry of the currentHead tree. |
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
@ -939,13 +976,16 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* whenever possible. |
|
|
|
* whenever possible. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Every tree supplies an object id, even if the tree does not contain the |
|
|
|
* Every tree supplies an object id, even if the tree does not contain the |
|
|
|
* current entry. In the latter case {@link ObjectId#zeroId()} is returned. |
|
|
|
* current entry. In the latter case |
|
|
|
|
|
|
|
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} is returned. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param nth |
|
|
|
* @param nth |
|
|
|
* tree to obtain the object identifier from. |
|
|
|
* tree to obtain the object identifier from. |
|
|
|
* @return object identifier for the current tree entry. |
|
|
|
* @return object identifier for the current tree entry. |
|
|
|
* @see #getObjectId(MutableObjectId, int) |
|
|
|
* @see #getObjectId(MutableObjectId, int) |
|
|
|
* @see #idEqual(int, int) |
|
|
|
* @see #idEqual(int, int) |
|
|
|
|
|
|
|
* @see #getObjectId(MutableObjectId, int) |
|
|
|
|
|
|
|
* @see #idEqual(int, int) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ObjectId getObjectId(final int nth) { |
|
|
|
public ObjectId getObjectId(final int nth) { |
|
|
|
final AbstractTreeIterator t = trees[nth]; |
|
|
|
final AbstractTreeIterator t = trees[nth]; |
|
|
@ -957,7 +997,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* Obtain the ObjectId for the current entry. |
|
|
|
* Obtain the ObjectId for the current entry. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Every tree supplies an object id, even if the tree does not contain the |
|
|
|
* Every tree supplies an object id, even if the tree does not contain the |
|
|
|
* current entry. In the latter case {@link ObjectId#zeroId()} is supplied. |
|
|
|
* current entry. In the latter case |
|
|
|
|
|
|
|
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} is supplied. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Applications should try to use {@link #idEqual(int, int)} when possible |
|
|
|
* Applications should try to use {@link #idEqual(int, int)} when possible |
|
|
|
* as it avoids conversion overheads. |
|
|
|
* as it avoids conversion overheads. |
|
|
@ -1055,6 +1096,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* Get the path length of the current entry. |
|
|
|
|
|
|
|
* |
|
|
|
* @return The path length of the current entry. |
|
|
|
* @return The path length of the current entry. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int getPathLength() { |
|
|
|
public int getPathLength() { |
|
|
@ -1243,17 +1286,17 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* If the current entry is a subtree this method arranges for its children |
|
|
|
* If the current entry is a subtree this method arranges for its children |
|
|
|
* to be returned before the next sibling following the subtree is returned. |
|
|
|
* to be returned before the next sibling following the subtree is returned. |
|
|
|
* |
|
|
|
* |
|
|
|
* @throws MissingObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.MissingObjectException |
|
|
|
* a subtree was found, but the subtree object does not exist in |
|
|
|
* a subtree was found, but the subtree object does not exist in |
|
|
|
* this repository. The repository may be missing objects. |
|
|
|
* this repository. The repository may be missing objects. |
|
|
|
* @throws IncorrectObjectTypeException |
|
|
|
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException |
|
|
|
* a subtree was found, and the subtree id does not denote a |
|
|
|
* a subtree was found, and the subtree id does not denote a |
|
|
|
* tree, but instead names some other non-tree type of object. |
|
|
|
* tree, but instead names some other non-tree type of object. |
|
|
|
* The repository may have data corruption. |
|
|
|
* The repository may have data corruption. |
|
|
|
* @throws CorruptObjectException |
|
|
|
* @throws org.eclipse.jgit.errors.CorruptObjectException |
|
|
|
* the contents of a tree did not appear to be a tree. The |
|
|
|
* the contents of a tree did not appear to be a tree. The |
|
|
|
* repository may have data corruption. |
|
|
|
* repository may have data corruption. |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
* a loose object or pack file could not be read. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void enterSubtree() throws MissingObjectException, |
|
|
|
public void enterSubtree() throws MissingObjectException, |
|
|
@ -1359,10 +1402,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* Get the tree of that type. |
|
|
|
|
|
|
|
* |
|
|
|
* @param type |
|
|
|
* @param type |
|
|
|
* of the tree to be queried |
|
|
|
* of the tree to be queried |
|
|
|
* @return the tree of that type or null if none is present |
|
|
|
* @return the tree of that type or null if none is present. |
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
|
|
|
|
|
* @param <T> |
|
|
|
|
|
|
|
* a tree type. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public <T extends AbstractTreeIterator> T getTree( |
|
|
|
public <T extends AbstractTreeIterator> T getTree( |
|
|
|
Class<T> type) { |
|
|
|
Class<T> type) { |
|
|
@ -1383,7 +1430,7 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { |
|
|
|
* which type of filterCommand should be executed. E.g. "clean", |
|
|
|
* which type of filterCommand should be executed. E.g. "clean", |
|
|
|
* "smudge" |
|
|
|
* "smudge" |
|
|
|
* @return a filter command |
|
|
|
* @return a filter command |
|
|
|
* @throws IOException |
|
|
|
* @throws java.io.IOException |
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String getFilterCommand(String filterCommandType) |
|
|
|
public String getFilterCommand(String filterCommandType) |
|
|
|