org.eclipse.jgit.api
Class DiffCommand

java.lang.Object
  extended by org.eclipse.jgit.api.GitCommand<List<DiffEntry>>
      extended by org.eclipse.jgit.api.DiffCommand
All Implemented Interfaces:
Callable<List<DiffEntry>>

public class DiffCommand
extends GitCommand<List<DiffEntry>>

Show changes between commits, commit and working tree, etc.

See Also:
Git documentation about diff

Field Summary
 
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
 
Constructor Summary
protected DiffCommand(Repository repo)
           
 
Method Summary
 List<DiffEntry> call()
          Executes the Diff command with all the options and parameters collected by the setter methods (e.g.
 DiffCommand setCached(boolean cached)
           
 DiffCommand setNewTree(AbstractTreeIterator newTree)
           
 DiffCommand setOldTree(AbstractTreeIterator oldTree)
           
 DiffCommand setPathFilter(TreeFilter pathFilter)
           
 DiffCommand setShowNameAndStatusOnly(boolean showNameAndStatusOnly)
           
 
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiffCommand

protected DiffCommand(Repository repo)
Parameters:
repo -
Method Detail

call

public List<DiffEntry> call()
                     throws GitAPIException,
                            IOException
Executes the Diff command with all the options and parameters collected by the setter methods (e.g. setCached(boolean) of this class. Each instance of this class should only be used for one invocation of the command. Don't call this method twice on an instance.

Returns:
a DiffEntry for each path which is different
Throws:
GitAPIException
IOException

setCached

public DiffCommand setCached(boolean cached)
Parameters:
cached - whether to view the changes you staged for the next commit
Returns:
this instance

setPathFilter

public DiffCommand setPathFilter(TreeFilter pathFilter)
Parameters:
pathFilter - parameter, used to limit the diff to the named path
Returns:
this instance

setOldTree

public DiffCommand setOldTree(AbstractTreeIterator oldTree)
Parameters:
oldTree - the previous state
Returns:
this instance

setNewTree

public DiffCommand setNewTree(AbstractTreeIterator newTree)
Parameters:
newTree - the updated state
Returns:
this instance

setShowNameAndStatusOnly

public DiffCommand setShowNameAndStatusOnly(boolean showNameAndStatusOnly)
Parameters:
showNameAndStatusOnly - whether to return only names and status of changed files
Returns:
this instance


Copyright © 2011. All Rights Reserved.