Class 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
    • Constructor Detail

      • RevertCommand

        protected RevertCommand​(Repository repo)

        Constructor for RevertCommand.

        Parameters:
        repo - the Repository
    • Method Detail

      • include

        public RevertCommand include​(Ref commit)
        Include a Ref to a commit to be reverted
        Parameters:
        commit - a reference to a commit to be reverted into the current head
        Returns:
        this
      • include

        public RevertCommand include​(AnyObjectId commit)
        Include a commit to be reverted
        Parameters:
        commit - the Id of a commit to be reverted into the current head
        Returns:
        this
      • include

        public RevertCommand include​(String name,
                                     AnyObjectId commit)
        Include a commit to be reverted
        Parameters:
        name - name of a Ref referring to the commit
        commit - the Id of a commit which is reverted into the current head
        Returns:
        this
      • setOurCommitName

        public RevertCommand setOurCommitName​(String ourCommitName)
        Set the name to be used in the "OURS" place for conflict markers
        Parameters:
        ourCommitName - the name that should be used in the "OURS" place for conflict markers
        Returns:
        this
      • getRevertedRefs

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

        public MergeResult getFailingResult()
        Get the result of a merge failure
        Returns:
        the result of a merge failure, null if no merge failure occurred during the revert
      • getUnmergedPaths

        public List<String> getUnmergedPaths()
        Get unmerged paths
        Returns:
        the unmerged paths, will be null if no merge conflicts
      • setStrategy

        public RevertCommand setStrategy​(MergeStrategy strategy)
        Set the merge strategy to use for this revert command
        Parameters:
        strategy - The merge strategy to use for this revert command.
        Returns:
        this
        Since:
        3.4