org.eclipse.jgit.lib
Class Tree

java.lang.Object
  extended by org.eclipse.jgit.lib.TreeEntry
      extended by org.eclipse.jgit.lib.Tree
All Implemented Interfaces:
Comparable

Deprecated. To look up information about a single path, use TreeWalk.forPath(Repository, String, org.eclipse.jgit.revwalk.RevTree). To lookup information about multiple paths at once, use a TreeWalk and obtain the current entry's information from its getter methods.

@Deprecated
public class Tree
extends TreeEntry

A representation of a Git tree entry. A Tree is a directory in Git.


Constructor Summary
Tree(Repository repo)
          Deprecated. Constructor for a new Tree
Tree(Repository repo, ObjectId myId, byte[] raw)
          Deprecated. Construct a Tree object with known content and hash value
Tree(Tree parent, byte[] nameUTF8)
          Deprecated. Construct a new Tree under another Tree
Tree(Tree parent, ObjectId id, byte[] nameUTF8)
          Deprecated. Construct a Tree with a known SHA-1 under another tree.
 
Method Summary
 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(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(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(String path)
          Deprecated.  
 boolean existsTree(String path)
          Deprecated.  
 TreeEntry findBlobMember(String s)
          Deprecated.  
 TreeEntry findTreeMember(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.
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 IOException
Deprecated. 
Construct a Tree object with known content and hash value

Parameters:
repo -
myId -
raw -
Throws:
IOException

Tree

public Tree(Tree parent,
            byte[] nameUTF8)
Deprecated. 
Construct a new Tree under another Tree

Parameters:
parent -
nameUTF8 -

Tree

public Tree(Tree parent,
            ObjectId id,
            byte[] nameUTF8)
Deprecated. 
Construct a Tree with a known SHA-1 under another tree. Data is not yet specified and will have to be loaded on demand.

Parameters:
parent -
id -
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 - name
b - name
lasta - '/' if a is a tree, else NUL
lastb - '/' 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. 
Specified by:
getMode in class TreeEntry
Returns:
mode (type of object)

isRoot

public boolean isRoot()
Deprecated. 
Returns:
true if this Tree is the top level Tree.

getRepository

public Repository getRepository()
Deprecated. 
Overrides:
getRepository in class TreeEntry
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(String name)
                      throws 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:
IOException

addFile

public FileTreeEntry addFile(byte[] s,
                             int offset)
                      throws 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 name
offset - when the name starts in the tree.
Returns:
a FileTreeEntry for the added file.
Throws:
IOException

addTree

public Tree addTree(String name)
             throws 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:
IOException

addTree

public Tree addTree(byte[] s,
                    int offset)
             throws 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 name
offset - when the name starts in the tree.
Returns:
a FileTreeEntry for the added tree.
Throws:
IOException

addEntry

public void addEntry(TreeEntry e)
              throws IOException
Deprecated. 
Add the specified tree entry to this tree.

Parameters:
e -
Throws:
IOException

memberCount

public int memberCount()
                throws IOException
Deprecated. 
Returns:
number of members in this tree
Throws:
IOException

members

public TreeEntry[] members()
                    throws 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:
IOException

existsTree

public boolean existsTree(String path)
                   throws IOException
Deprecated. 
Parameters:
path - to the tree.
Returns:
true if a tree with the specified path can be found under this tree.
Throws:
IOException

existsBlob

public boolean existsBlob(String path)
                   throws 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:
IOException

findBlobMember

public TreeEntry findBlobMember(String s)
                         throws IOException
Deprecated. 
Parameters:
s - blob name
Returns:
a TreeEntry representing an object with the specified relative path.
Throws:
IOException

findTreeMember

public TreeEntry findTreeMember(String s)
                         throws IOException
Deprecated. 
Parameters:
s - Tree Name
Returns:
a Tree with the name s or null
Throws:
IOException

format

public byte[] format()
              throws IOException
Deprecated. 
Format this Tree in canonical format.

Returns:
canonical encoding of the tree object.
Throws:
IOException - the tree cannot be loaded, or its not in a writable state.

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.