org.gitective.core
Class CommitFinder

java.lang.Object
  extended by org.gitective.core.RepositoryService
      extended by org.gitective.core.CommitFinder

public class CommitFinder
extends RepositoryService

Commit finder class for locating commits based on combining TreeFilter and RevFilter instances and performing a RevWalk on one or more Git repositories.


Field Summary
protected  org.eclipse.jgit.revwalk.filter.RevFilter commitFilter
          Commit filter for selecting commits to match
protected  org.eclipse.jgit.revwalk.filter.RevFilter commitMatcher
          Commit filter for matches
protected  org.eclipse.jgit.revwalk.RevSort sort
          Sort strategy for RevWalk
protected  org.eclipse.jgit.treewalk.filter.TreeFilter treeFilter
          Tree filter for selecting commits to match
 
Fields inherited from class org.gitective.core.RepositoryService
repositories
 
Constructor Summary
CommitFinder(Collection<?> repositories)
          Create a commit finder for th given repository collection
CommitFinder(File... gitDirs)
          Create a commit finder for the given Git directories.
CommitFinder(org.eclipse.jgit.lib.Repository... repositories)
          Create a commit finder for the given Git repositories.
CommitFinder(String... gitDirs)
          Create a commit finder for the given Git directory paths.
 
Method Summary
protected  org.eclipse.jgit.revwalk.RevWalk createWalk(org.eclipse.jgit.lib.Repository repository)
          Create a newly configured RevWalk for the repository
 CommitFinder find()
          Search the commits starting at the commit that HEAD current references.
 CommitFinder findBetween(org.eclipse.jgit.lib.ObjectId start, org.eclipse.jgit.lib.ObjectId end)
          Search the commits between the given start and end commits.
 CommitFinder findBetween(org.eclipse.jgit.lib.ObjectId start, String end)
          Search the commits between the given start commit id and the given end revision.
 CommitFinder findBetween(String start, org.eclipse.jgit.lib.ObjectId end)
          Search the commits between the given start revision and the given end commit id.
 CommitFinder findBetween(String start, String end)
          Search the commits between the given start revision and the given end revision.
 CommitFinder findFrom(org.eclipse.jgit.lib.ObjectId start)
          Search the commits starting from the given commit id.
 CommitFinder findFrom(String start)
          Search the commits starting from the given revision.
 CommitFinder findInBranches()
          Search the commits starting at the commit that each branch is referencing.
 CommitFinder findInTags()
          Search the commits starting at the commit that each tag is referencing.
 CommitFinder findUntil(org.eclipse.jgit.lib.ObjectId end)
          Search the commits starting at HEAD and ending with the given commit id
 CommitFinder findUntil(String end)
          Search the commits starting at HEAD and ending with the given revision
 CommitFinder setFilter(org.eclipse.jgit.revwalk.filter.RevFilter filter)
          Set the RevFilter to use to filter commits during searches.
 CommitFinder setFilter(org.eclipse.jgit.treewalk.filter.TreeFilter filter)
          Set the TreeFilter to use to limit commits visited.
 CommitFinder setMatcher(org.eclipse.jgit.revwalk.filter.RevFilter filter)
          Set the RevFilter to use to match filtered commits.
 CommitFinder setReverseOrder(boolean reverse)
          Set whether to use RevSort.REVERSE to sort commits
protected  CommitFinder walk(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId start, org.eclipse.jgit.lib.ObjectId end)
          Walk the commits between the start commit id and end commit id.
protected  CommitFinder walk(org.eclipse.jgit.revwalk.RevWalk walk)
          Traverse the commits in the given RevWalk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commitFilter

protected org.eclipse.jgit.revwalk.filter.RevFilter commitFilter
Commit filter for selecting commits to match


treeFilter

protected org.eclipse.jgit.treewalk.filter.TreeFilter treeFilter
Tree filter for selecting commits to match


commitMatcher

protected org.eclipse.jgit.revwalk.filter.RevFilter commitMatcher
Commit filter for matches


sort

protected org.eclipse.jgit.revwalk.RevSort sort
Sort strategy for RevWalk

Constructor Detail

CommitFinder

public CommitFinder(File... gitDirs)
Create a commit finder for the given Git directories.

Parameters:
gitDirs -

CommitFinder

public CommitFinder(org.eclipse.jgit.lib.Repository... repositories)
Create a commit finder for the given Git repositories.

Parameters:
repositories -

CommitFinder

public CommitFinder(String... gitDirs)
Create a commit finder for the given Git directory paths.

Parameters:
gitDirs -

CommitFinder

public CommitFinder(Collection<?> repositories)
Create a commit finder for th given repository collection

Parameters:
repositories -
Method Detail

setFilter

public CommitFinder setFilter(org.eclipse.jgit.revwalk.filter.RevFilter filter)
Set the RevFilter to use to filter commits during searches.

Parameters:
filter -
Returns:
this service

setMatcher

public CommitFinder setMatcher(org.eclipse.jgit.revwalk.filter.RevFilter filter)
Set the RevFilter to use to match filtered commits.

Parameters:
filter -
Returns:
this service

setFilter

public CommitFinder setFilter(org.eclipse.jgit.treewalk.filter.TreeFilter filter)
Set the TreeFilter to use to limit commits visited.

Parameters:
filter -
Returns:
this service

setReverseOrder

public CommitFinder setReverseOrder(boolean reverse)
Set whether to use RevSort.REVERSE to sort commits

This will only affect the order that commits are passed to the filter set by calling setMatcher(RevFilter). The filter set by calling setFilter(RevFilter) will still visit commits in starting order.

Parameters:
reverse -
Returns:
this service

createWalk

protected org.eclipse.jgit.revwalk.RevWalk createWalk(org.eclipse.jgit.lib.Repository repository)
Create a newly configured RevWalk for the repository

Parameters:
repository -
Returns:
new RevWalk

walk

protected CommitFinder walk(org.eclipse.jgit.revwalk.RevWalk walk)
                     throws IOException
Traverse the commits in the given RevWalk

Parameters:
walk -
Returns:
this finder
Throws:
IOException

walk

protected CommitFinder walk(org.eclipse.jgit.lib.Repository repository,
                            org.eclipse.jgit.lib.ObjectId start,
                            org.eclipse.jgit.lib.ObjectId end)
Walk the commits between the start commit id and end commit id.

Parameters:
repository -
start - must be non-null
end -
Returns:
this service

findFrom

public CommitFinder findFrom(org.eclipse.jgit.lib.ObjectId start)
Search the commits starting from the given commit id.

Parameters:
start -
Returns:
this service

findFrom

public CommitFinder findFrom(String start)
Search the commits starting from the given revision.

Parameters:
start -
Returns:
this service

find

public CommitFinder find()
Search the commits starting at the commit that HEAD current references.

Returns:
this service

findInTags

public CommitFinder findInTags()
Search the commits starting at the commit that each tag is referencing.

Repositories that have no tags will be ignored.

Returns:
this finder

findInBranches

public CommitFinder findInBranches()
Search the commits starting at the commit that each branch is referencing.

Repositories that have no branches will be ignored.

Returns:
this finder

findBetween

public CommitFinder findBetween(org.eclipse.jgit.lib.ObjectId start,
                                org.eclipse.jgit.lib.ObjectId end)
Search the commits between the given start and end commits.

Parameters:
start -
end -
Returns:
this service

findBetween

public CommitFinder findBetween(String start,
                                org.eclipse.jgit.lib.ObjectId end)
Search the commits between the given start revision and the given end commit id.

Parameters:
start -
end -
Returns:
this service

findBetween

public CommitFinder findBetween(org.eclipse.jgit.lib.ObjectId start,
                                String end)
Search the commits between the given start commit id and the given end revision.

Parameters:
start -
end -
Returns:
this service

findBetween

public CommitFinder findBetween(String start,
                                String end)
Search the commits between the given start revision and the given end revision.

Parameters:
start -
end -
Returns:
this service

findUntil

public CommitFinder findUntil(String end)
Search the commits starting at HEAD and ending with the given revision

Parameters:
end -
Returns:
this service

findUntil

public CommitFinder findUntil(org.eclipse.jgit.lib.ObjectId end)
Search the commits starting at HEAD and ending with the given commit id

Parameters:
end -
Returns:
this service


Copyright © 2011-2012. All Rights Reserved.