org.eclipse.jgit.api
Class RevertCommand

java.lang.Object
  extended by org.eclipse.jgit.api.GitCommand<RevCommit>
      extended by org.eclipse.jgit.api.RevertCommand
All Implemented Interfaces:
Callable<RevCommit>

public class RevertCommand
extends GitCommand<RevCommit>

A class used to execute a revert command. It has setters for all supported options and arguments of this command and a call() method to finally execute the command. Each instance of this class should only be used for one invocation of the command (means: one call to call())

See Also:
Git documentation about revert

Field Summary
 
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
 
Constructor Summary
protected RevertCommand(Repository repo)
           
 
Method Summary
 RevCommit call()
          Executes the revert command with all the options and parameters collected by the setter methods (e.g.
 List<Ref> getRevertedRefs()
           
 RevertCommand include(AnyObjectId commit)
           
 RevertCommand include(Ref commit)
           
 RevertCommand include(String name, AnyObjectId commit)
           
 
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

RevertCommand

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

call

public RevCommit call()
               throws GitAPIException
Executes the revert command with all the options and parameters collected by the setter methods (e.g. include(Ref) 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:
on success the RevCommit pointed to by the new HEAD is returned. If a failure occurred during revert null is returned. The list of successfully reverted Ref's can be obtained by calling getRevertedRefs()
Throws:
GitAPIException

include

public RevertCommand include(Ref commit)
Parameters:
commit - a reference to a commit which is reverted into the current head
Returns:
this

include

public RevertCommand include(AnyObjectId commit)
Parameters:
commit - the Id of a commit which is reverted into the current head
Returns:
this

include

public RevertCommand include(String name,
                             AnyObjectId commit)
Parameters:
name - a name given to the commit
commit - the Id of a commit which is reverted into the current head
Returns:
this

getRevertedRefs

public List<Ref> getRevertedRefs()
Returns:
the list of successfully reverted Ref's. Never null but maybe an empty list if no commit was successfully cherry-picked


Copyright © 2011. All Rights Reserved.