Class CherryPickChange


  • public class CherryPickChange
    extends Object
    • Method Detail

      • cherryPick

        public com.google.gerrit.server.restapi.change.CherryPickChange.Result cherryPick​(Change sourceChange,
                                                                                          Project.NameKey project,
                                                                                          org.eclipse.jgit.lib.ObjectId sourceCommit,
                                                                                          CherryPickInput input,
                                                                                          BranchNameKey dest)
                                                                                   throws IOException,
                                                                                          InvalidChangeOperationException,
                                                                                          UpdateException,
                                                                                          RestApiException,
                                                                                          org.eclipse.jgit.errors.ConfigInvalidException,
                                                                                          NoSuchProjectException
        This function is called directly to cherry pick a commit. Also, it is used to cherry pick a change as well as long as sourceChange is not null.
        Parameters:
        sourceChange - Change to cherry pick. Can be null, and then the function will only cherry pick a commit.
        project - Project name
        sourceCommit - Id of the commit to be cherry picked.
        input - Input object for different configurations of cherry pick.
        dest - Destination branch for the cherry pick.
        Returns:
        Result object that describes the cherry pick.
        Throws:
        IOException - Unable to open repository or read from the database.
        InvalidChangeOperationException - Parent or branch don't exist, or two changes with same key exist in the branch.
        UpdateException - Problem updating the database using batchUpdateFactory.
        RestApiException - Error such as invalid SHA1
        org.eclipse.jgit.errors.ConfigInvalidException - Can't find account to notify.
        NoSuchProjectException - Can't find project state.
      • cherryPick

        public com.google.gerrit.server.restapi.change.CherryPickChange.Result cherryPick​(Change sourceChange,
                                                                                          Project.NameKey project,
                                                                                          org.eclipse.jgit.lib.ObjectId sourceCommit,
                                                                                          CherryPickInput input,
                                                                                          BranchNameKey dest,
                                                                                          Instant timestamp,
                                                                                          Change.Id revertedChange,
                                                                                          org.eclipse.jgit.lib.ObjectId changeIdForNewChange,
                                                                                          Change.Id idForNewChange,
                                                                                          Boolean workInProgress)
                                                                                   throws IOException,
                                                                                          InvalidChangeOperationException,
                                                                                          UpdateException,
                                                                                          RestApiException,
                                                                                          org.eclipse.jgit.errors.ConfigInvalidException,
                                                                                          NoSuchProjectException
        This function can be called directly to cherry-pick a change (or commit if sourceChange is null) with a few other parameters that are especially useful for cherry-picking a commit that is the revert-of another change.
        Parameters:
        sourceChange - Change to cherry pick. Can be null, and then the function will only cherry pick a commit.
        project - Project name
        sourceCommit - Id of the commit to be cherry picked.
        input - Input object for different configurations of cherry pick.
        dest - Destination branch for the cherry pick.
        timestamp - the current timestamp.
        revertedChange - The id of the change that is reverted. This is used for the "revertOf" field to mark the created cherry pick change as "revertOf" the original change that was reverted.
        changeIdForNewChange - The Change-Id that the new change of the cherry pick will have.
        idForNewChange - The ID that the new change of the cherry pick will have. If provided and the cherry-pick doesn't result in creating a new change, then InvalidChangeOperationException is thrown.
        Returns:
        Result object that describes the cherry pick.
        Throws:
        IOException - Unable to open repository or read from the database.
        InvalidChangeOperationException - Parent or branch don't exist, or two changes with same key exist in the branch. Also thrown when idForNewChange is not null but cherry-pick only creates a new patchset rather than a new change.
        UpdateException - Problem updating the database using batchUpdateFactory.
        RestApiException - Error such as invalid SHA1
        org.eclipse.jgit.errors.ConfigInvalidException - Can't find account to notify.
        NoSuchProjectException - Can't find project state.