org.gitective.core
Class TreeUtils

java.lang.Object
  extended by org.gitective.core.TreeUtils

public abstract class TreeUtils
extends Object

Utilities for dealing with Git trees.


Nested Class Summary
static interface TreeUtils.ITreeVisitor
          Interface for visiting elements in a tree
 
Constructor Summary
TreeUtils()
           
 
Method Summary
static org.eclipse.jgit.treewalk.TreeWalk diffWithCommits(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId... commits)
          Create a tree walk configured to diff the given commits
static org.eclipse.jgit.treewalk.TreeWalk diffWithCommits(org.eclipse.jgit.lib.Repository repository, String... revisions)
          Create a tree walk configured to diff the given commit revisions
static org.eclipse.jgit.treewalk.TreeWalk diffWithParents(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.AnyObjectId commitId)
          Create a tree walk configured to diff the given commit against all the parent commits.
static org.eclipse.jgit.treewalk.TreeWalk diffWithParents(org.eclipse.jgit.lib.Repository repository, String revision)
          Create a tree walk configured to diff the given revision against all the parent commits.
static org.eclipse.jgit.treewalk.TreeWalk diffWithParents(org.eclipse.jgit.revwalk.RevWalk walk, org.eclipse.jgit.revwalk.RevCommit commit)
          Create a tree walk configured to diff the given commit against all the parent commits.
static org.eclipse.jgit.lib.ObjectId getId(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId commitId, String path)
          Get the id of the tree at the path in the given commit
static org.eclipse.jgit.lib.ObjectId getId(org.eclipse.jgit.lib.Repository repository, String revision, String path)
          Get the id of the tree at the path in the given revision
protected static org.eclipse.jgit.revwalk.RevTree getTree(org.eclipse.jgit.revwalk.RevWalk walk, org.eclipse.jgit.revwalk.RevCommit commit)
          Get the tree associated with the given commit.
protected static org.eclipse.jgit.lib.ObjectId lookupId(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.revwalk.RevCommit commit, String path)
          Get the id of the tree at the path in the given commit.
static boolean visit(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId treeId, TreeUtils.ITreeVisitor visitor)
          Visit entries in the given tree
static org.eclipse.jgit.treewalk.TreeWalk withCommits(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId... commits)
          Create a tree walk configured with the given commits
static org.eclipse.jgit.treewalk.TreeWalk withCommits(org.eclipse.jgit.lib.Repository repository, String... revisions)
          Create a tree walk configured with the given commit revisions
protected static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.lib.ObjectReader reader, org.eclipse.jgit.revwalk.RevWalk rWalk, org.eclipse.jgit.revwalk.RevCommit commit)
          Create a tree walk with the commit's parents.
static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.AnyObjectId commitId)
          Create a tree walk with all the trees from the given commit's parents.
static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.lib.Repository repository, String revision)
          Create a tree walk with all the trees from the given revision's commit parents.
static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.revwalk.RevWalk walk, org.eclipse.jgit.revwalk.RevCommit commit)
          Create a tree walk with all the trees from the given commit's parents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeUtils

public TreeUtils()
Method Detail

getTree

protected static org.eclipse.jgit.revwalk.RevTree getTree(org.eclipse.jgit.revwalk.RevWalk walk,
                                                          org.eclipse.jgit.revwalk.RevCommit commit)
                                                   throws IOException
Get the tree associated with the given commit.

Parameters:
walk -
commit -
Returns:
tree
Throws:
IOException

withParents

protected static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.lib.ObjectReader reader,
                                                                org.eclipse.jgit.revwalk.RevWalk rWalk,
                                                                org.eclipse.jgit.revwalk.RevCommit commit)
                                                         throws IOException
Create a tree walk with the commit's parents.

Parameters:
reader -
rWalk -
commit -
Returns:
tree walk
Throws:
IOException

withParents

public static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.lib.Repository repository,
                                                             org.eclipse.jgit.lib.AnyObjectId commitId)
Create a tree walk with all the trees from the given commit's parents.

Parameters:
repository -
commitId -
Returns:
tree walk

withParents

public static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.lib.Repository repository,
                                                             String revision)
Create a tree walk with all the trees from the given revision's commit parents.

Parameters:
repository -
revision -
Returns:
tree walk

withParents

public static org.eclipse.jgit.treewalk.TreeWalk withParents(org.eclipse.jgit.revwalk.RevWalk walk,
                                                             org.eclipse.jgit.revwalk.RevCommit commit)
Create a tree walk with all the trees from the given commit's parents.

Parameters:
walk -
commit -
Returns:
tree walk

diffWithParents

public static org.eclipse.jgit.treewalk.TreeWalk diffWithParents(org.eclipse.jgit.lib.Repository repository,
                                                                 org.eclipse.jgit.lib.AnyObjectId commitId)
Create a tree walk configured to diff the given commit against all the parent commits.

Parameters:
repository -
commitId -
Returns:
tree walk

diffWithParents

public static org.eclipse.jgit.treewalk.TreeWalk diffWithParents(org.eclipse.jgit.revwalk.RevWalk walk,
                                                                 org.eclipse.jgit.revwalk.RevCommit commit)
Create a tree walk configured to diff the given commit against all the parent commits.

Parameters:
walk -
commit -
Returns:
tree walk

diffWithParents

public static org.eclipse.jgit.treewalk.TreeWalk diffWithParents(org.eclipse.jgit.lib.Repository repository,
                                                                 String revision)
Create a tree walk configured to diff the given revision against all the parent commits.

Parameters:
repository -
revision -
Returns:
tree walk

withCommits

public static org.eclipse.jgit.treewalk.TreeWalk withCommits(org.eclipse.jgit.lib.Repository repository,
                                                             String... revisions)
Create a tree walk configured with the given commit revisions

Parameters:
repository -
revisions -
Returns:
tree walk

withCommits

public static org.eclipse.jgit.treewalk.TreeWalk withCommits(org.eclipse.jgit.lib.Repository repository,
                                                             org.eclipse.jgit.lib.ObjectId... commits)
Create a tree walk configured with the given commits

Parameters:
repository -
commits -
Returns:
tree walk

diffWithCommits

public static org.eclipse.jgit.treewalk.TreeWalk diffWithCommits(org.eclipse.jgit.lib.Repository repository,
                                                                 org.eclipse.jgit.lib.ObjectId... commits)
Create a tree walk configured to diff the given commits

Parameters:
repository -
commits -
Returns:
tree walk

diffWithCommits

public static org.eclipse.jgit.treewalk.TreeWalk diffWithCommits(org.eclipse.jgit.lib.Repository repository,
                                                                 String... revisions)
Create a tree walk configured to diff the given commit revisions

Parameters:
repository -
revisions -
Returns:
tree walk

lookupId

protected static org.eclipse.jgit.lib.ObjectId lookupId(org.eclipse.jgit.lib.Repository repository,
                                                        org.eclipse.jgit.revwalk.RevCommit commit,
                                                        String path)
Get the id of the tree at the path in the given commit.

Parameters:
repository -
commit -
path -
Returns:
tree id, null if not present

getId

public static org.eclipse.jgit.lib.ObjectId getId(org.eclipse.jgit.lib.Repository repository,
                                                  org.eclipse.jgit.lib.ObjectId commitId,
                                                  String path)
Get the id of the tree at the path in the given commit

Parameters:
repository -
commitId -
path -
Returns:
tree id or null if no tree id at path

getId

public static org.eclipse.jgit.lib.ObjectId getId(org.eclipse.jgit.lib.Repository repository,
                                                  String revision,
                                                  String path)
Get the id of the tree at the path in the given revision

Parameters:
repository -
revision -
path -
Returns:
tree id or null if no tree id at path

visit

public static boolean visit(org.eclipse.jgit.lib.Repository repository,
                            org.eclipse.jgit.lib.ObjectId treeId,
                            TreeUtils.ITreeVisitor visitor)
Visit entries in the given tree

Parameters:
repository -
treeId -
visitor -
Returns:
true if completely completely, false if terminated early


Copyright © 2011-2012. All Rights Reserved.