Package org.eclipse.jgit.lib
Class Tree
- java.lang.Object
-
- org.eclipse.jgit.lib.TreeEntry
-
- org.eclipse.jgit.lib.Tree
-
- All Implemented Interfaces:
java.lang.Comparable
@Deprecated public class Tree extends TreeEntry
Deprecated.To look up information about a single path, useTreeWalk.forPath(Repository, String, org.eclipse.jgit.revwalk.RevTree)
. To lookup information about multiple paths at once, use aTreeWalk
and obtain the current entry's information from its getter methods.A representation of a Git tree entry. A Tree is a directory in Git.
-
-
Constructor Summary
Constructors Constructor Description Tree(Repository repo)
Deprecated.Constructor for a new TreeTree(Repository repo, ObjectId myId, byte[] raw)
Deprecated.Construct a Tree object with known content and hash valueTree(Tree parent, byte[] nameUTF8)
Deprecated.Construct a new Tree under another TreeTree(Tree parent, ObjectId id, byte[] nameUTF8)
Deprecated.Construct a Tree with a known SHA-1 under another tree.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addEntry(TreeEntry e)
Deprecated.Add the specified tree entry to this tree.FileTreeEntry
addFile(byte[] s, int offset)
Deprecated.Adds a new or existing file with the specified name to this tree.FileTreeEntry
addFile(java.lang.String name)
Deprecated.Adds a new or existing file with the specified name to this tree.Tree
addTree(byte[] s, int offset)
Deprecated.Adds a new or existing Tree with the specified name to this tree.Tree
addTree(java.lang.String name)
Deprecated.Adds a new or existing Tree with the specified name to this tree.static int
compareNames(byte[] a, byte[] b, int lasta, int lastb)
Deprecated.Compare two names represented as bytes.boolean
existsBlob(java.lang.String path)
Deprecated.boolean
existsTree(java.lang.String path)
Deprecated.TreeEntry
findBlobMember(java.lang.String s)
Deprecated.TreeEntry
findTreeMember(java.lang.String s)
Deprecated.byte[]
format()
Deprecated.Format this Tree in canonical format.FileMode
getMode()
Deprecated.Repository
getRepository()
Deprecated.boolean
isLoaded()
Deprecated.boolean
isRoot()
Deprecated.int
memberCount()
Deprecated.TreeEntry[]
members()
Deprecated.Return all members of the tree sorted in Git order.java.lang.String
toString()
Deprecated.void
unload()
Deprecated.Forget the in-memory data for this tree.-
Methods inherited from class org.eclipse.jgit.lib.TreeEntry
compareTo, delete, detachParent, getFullName, getFullNameUTF8, getId, getName, getNameUTF8, getParent, isModified, lastChar, rename, rename, setId, setModified
-
-
-
-
Constructor Detail
-
Tree
public Tree(Repository repo)
Deprecated.Constructor for a new Tree- Parameters:
repo
- The repository that owns the Tree.
-
Tree
public Tree(Repository repo, ObjectId myId, byte[] raw) throws java.io.IOException
Deprecated.Construct a Tree object with known content and hash value- Parameters:
repo
-myId
-raw
-- Throws:
java.io.IOException
-
Tree
public Tree(Tree parent, byte[] nameUTF8)
Deprecated.Construct a new Tree under another Tree- Parameters:
parent
-nameUTF8
-
-
-
Method Detail
-
compareNames
public static final int compareNames(byte[] a, byte[] b, int lasta, int lastb)
Deprecated.Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal.- Parameters:
a
- nameb
- namelasta
- '/' if a is a tree, else NULlastb
- '/' if b is a tree, else NUL- Returns:
- < 0 if a is sorted before b, 0 if they are the same, else b
-
getMode
public FileMode getMode()
Deprecated.
-
isRoot
public boolean isRoot()
Deprecated.- Returns:
- true if this Tree is the top level Tree.
-
getRepository
public Repository getRepository()
Deprecated.- Overrides:
getRepository
in classTreeEntry
- Returns:
- the repository owning this entry.
-
isLoaded
public boolean isLoaded()
Deprecated.- Returns:
- true of the data of this Tree is loaded
-
unload
public void unload()
Deprecated.Forget the in-memory data for this tree.
-
addFile
public FileTreeEntry addFile(java.lang.String name) throws java.io.IOException
Deprecated.Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.- Parameters:
name
- Name- Returns:
- a
FileTreeEntry
for the added file. - Throws:
java.io.IOException
-
addFile
public FileTreeEntry addFile(byte[] s, int offset) throws java.io.IOException
Deprecated.Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.- Parameters:
s
- an array containing the nameoffset
- when the name starts in the tree.- Returns:
- a
FileTreeEntry
for the added file. - Throws:
java.io.IOException
-
addTree
public Tree addTree(java.lang.String name) throws java.io.IOException
Deprecated.Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.- Parameters:
name
- Name- Returns:
- a
FileTreeEntry
for the added tree. - Throws:
java.io.IOException
-
addTree
public Tree addTree(byte[] s, int offset) throws java.io.IOException
Deprecated.Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.- Parameters:
s
- an array containing the nameoffset
- when the name starts in the tree.- Returns:
- a
FileTreeEntry
for the added tree. - Throws:
java.io.IOException
-
addEntry
public void addEntry(TreeEntry e) throws java.io.IOException
Deprecated.Add the specified tree entry to this tree.- Parameters:
e
-- Throws:
java.io.IOException
-
memberCount
public int memberCount() throws java.io.IOException
Deprecated.- Returns:
- number of members in this tree
- Throws:
java.io.IOException
-
members
public TreeEntry[] members() throws java.io.IOException
Deprecated.Return all members of the tree sorted in Git order. Entries are sorted by the numerical unsigned byte values with (sub)trees having an implicit '/'. An example of a tree with three entries. a:b is an actual file name here.100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a.b 040000 tree 4277b6e69d25e5efa77c455340557b384a4c018a a 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a:b
- Returns:
- all entries in this Tree, sorted.
- Throws:
java.io.IOException
-
existsTree
public boolean existsTree(java.lang.String path) throws java.io.IOException
Deprecated.- Parameters:
path
- to the tree.- Returns:
- true if a tree with the specified path can be found under this tree.
- Throws:
java.io.IOException
-
existsBlob
public boolean existsBlob(java.lang.String path) throws java.io.IOException
Deprecated.- Parameters:
path
- of the non-tree entry.- Returns:
- true if a blob, symlink, or gitlink with the specified name can be found under this tree.
- Throws:
java.io.IOException
-
findBlobMember
public TreeEntry findBlobMember(java.lang.String s) throws java.io.IOException
Deprecated.- Parameters:
s
- blob name- Returns:
- a
TreeEntry
representing an object with the specified relative path. - Throws:
java.io.IOException
-
findTreeMember
public TreeEntry findTreeMember(java.lang.String s) throws java.io.IOException
Deprecated.- Parameters:
s
- Tree Name- Returns:
- a Tree with the name s or null
- Throws:
java.io.IOException
-
format
public byte[] format() throws java.io.IOException
Deprecated.Format this Tree in canonical format.- Returns:
- canonical encoding of the tree object.
- Throws:
java.io.IOException
- the tree cannot be loaded, or its not in a writable state.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-