org.gitective.core.filter.commit
Class CommitDiffFilter

java.lang.Object
  extended by org.eclipse.jgit.revwalk.filter.RevFilter
      extended by org.gitective.core.filter.commit.CommitFilter
          extended by org.gitective.core.filter.commit.CommitDiffFilter
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CommitDiffEditFilter, CommitFileImpactFilter, CompositeDiffFilter, DiffFileCountFilter, DiffFileSizeFilter, DuplicateBlobFilter, FileHistogramFilter, LastCommitDiffFilter

public class CommitDiffFilter
extends CommitFilter

Commit diff filter that computes the differences introduced by each commit visited and calls include(RevWalk, RevCommit, Collection).

See Also:
include(RevWalk, RevCommit, Collection)

Field Summary
protected  boolean detectRenames
          True to detect renames, false otherwise
protected  org.eclipse.jgit.diff.RenameDetector renameDetector
          Rename detector
 
Fields inherited from class org.gitective.core.filter.commit.CommitFilter
repository
 
Fields inherited from class org.eclipse.jgit.revwalk.filter.RevFilter
ALL, MERGE_BASE, NO_MERGES, NONE
 
Constructor Summary
CommitDiffFilter()
          Create commit diff filter
CommitDiffFilter(boolean detectRenames)
          Create commit diff filter
 
Method Summary
protected  org.eclipse.jgit.treewalk.TreeWalk createTreeWalk(org.eclipse.jgit.revwalk.RevWalk walker, org.eclipse.jgit.revwalk.RevCommit commit)
          Create tree walk to compute differences for the given commits
 boolean include(org.eclipse.jgit.revwalk.RevCommit commit, Collection<org.eclipse.jgit.diff.DiffEntry> diffs)
          Handle the differences introduced by given commit.
 boolean include(org.eclipse.jgit.revwalk.RevWalk walker, org.eclipse.jgit.revwalk.RevCommit commit)
           
 boolean include(org.eclipse.jgit.revwalk.RevWalk walker, org.eclipse.jgit.revwalk.RevCommit commit, Collection<org.eclipse.jgit.diff.DiffEntry> diffs)
          Handle the differences introduced by given commit.
protected  boolean isFileDiff(org.eclipse.jgit.diff.DiffEntry diff)
          Is the given diff entry a file?
 CommitFilter setRepository(org.eclipse.jgit.lib.Repository repository)
          Set the repository for the walk that is about to begin.
 
Methods inherited from class org.gitective.core.filter.commit.CommitFilter
clone, include, reset, setStop
 
Methods inherited from class org.eclipse.jgit.revwalk.filter.RevFilter
negate, requiresCommitBody, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

detectRenames

protected final boolean detectRenames
True to detect renames, false otherwise


renameDetector

protected org.eclipse.jgit.diff.RenameDetector renameDetector
Rename detector

Constructor Detail

CommitDiffFilter

public CommitDiffFilter()
Create commit diff filter


CommitDiffFilter

public CommitDiffFilter(boolean detectRenames)
Create commit diff filter

Parameters:
detectRenames - true to detect renames, false otherwise
Method Detail

setRepository

public CommitFilter setRepository(org.eclipse.jgit.lib.Repository repository)
Description copied from class: CommitFilter
Set the repository for the walk that is about to begin.

Overrides:
setRepository in class CommitFilter
Returns:
this filter

createTreeWalk

protected org.eclipse.jgit.treewalk.TreeWalk createTreeWalk(org.eclipse.jgit.revwalk.RevWalk walker,
                                                            org.eclipse.jgit.revwalk.RevCommit commit)
Create tree walk to compute differences for the given commits

Sub-classes may override this method to create a custom tree walk with different filtering options set.

The last tree in the tree walk is assumed to be the tree of the current commit

Parameters:
walker -
commit -
Returns:
tree walk

include

public boolean include(org.eclipse.jgit.revwalk.RevWalk walker,
                       org.eclipse.jgit.revwalk.RevCommit commit)
                throws IOException
Specified by:
include in class org.eclipse.jgit.revwalk.filter.RevFilter
Throws:
IOException

isFileDiff

protected boolean isFileDiff(org.eclipse.jgit.diff.DiffEntry diff)
Is the given diff entry a file?

Parameters:
diff -
Returns:
true if a regular or executable file, false otherwise

include

public boolean include(org.eclipse.jgit.revwalk.RevWalk walker,
                       org.eclipse.jgit.revwalk.RevCommit commit,
                       Collection<org.eclipse.jgit.diff.DiffEntry> diffs)
                throws IOException
Handle the differences introduced by given commit.

Sub-classes should override this method. The default implementation calls include(RevCommit, Collection).

Parameters:
walker - non-null
commit - non-null
diffs - non-null
Returns:
true to continue, false to abort
Throws:
IOException

include

public boolean include(org.eclipse.jgit.revwalk.RevCommit commit,
                       Collection<org.eclipse.jgit.diff.DiffEntry> diffs)
                throws IOException
Handle the differences introduced by given commit.

Sub-classes should override this method. The default implementation returns true in all cases.

Parameters:
commit - non-null
diffs - non-null
Returns:
true to continue, false to abort
Throws:
IOException


Copyright © 2011-2012. All Rights Reserved.