Class ChangeUpdate


  • public class ChangeUpdate
    extends AbstractChangeUpdate
    A delta to apply to a change.

    This delta will become two unique commits: one in the AllUsers repo that will contain the draft comments on this change and one in the notes branch that will contain approvals, reviewers, change status, subject, submit records, the change message, and published comments. There are limitations on the set of modifications that can be handled in a single update. In particular, there is a single author and timestamp for each update.

    This class is not thread-safe.

    • Method Detail

      • setChangeId

        public void setChangeId​(String changeId)
      • setBranch

        public void setBranch​(String branch)
      • putApproval

        public void putApproval​(String label,
                                short value)
      • putApprovalFor

        public void putApprovalFor​(Account.Id reviewer,
                                   String label,
                                   short value)
      • removeApproval

        public void removeApproval​(String label)
      • removeApprovalFor

        public void removeApprovalFor​(Account.Id reviewer,
                                      String label)
      • merge

        public void merge​(com.google.gerrit.server.logging.RequestId submissionId,
                          Iterable<SubmitRecord> submitRecords)
      • setSubjectForCommit

        public void setSubjectForCommit​(String commitSubject)
      • setSubject

        public void setSubject​(String subject)
      • setChangeMessage

        public void setChangeMessage​(String changeMessage)
      • setTag

        public void setTag​(String tag)
      • setPsDescription

        public void setPsDescription​(String psDescription)
      • putRobotComment

        public void putRobotComment​(RobotComment c)
      • deleteComment

        public void deleteComment​(Comment c)
      • deleteCommentByRewritingHistory

        public void deleteCommentByRewritingHistory​(String uuid,
                                                    String newMessage)
      • deleteChangeMessageByRewritingHistory

        public void deleteChangeMessageByRewritingHistory​(String targetMessageId,
                                                          String newMessage)
      • setTopic

        public void setTopic​(String topic)
      • setCommit

        public void setCommit​(org.eclipse.jgit.revwalk.RevWalk rw,
                              org.eclipse.jgit.lib.ObjectId id)
                       throws IOException
        Throws:
        IOException
      • setCommit

        public void setCommit​(org.eclipse.jgit.revwalk.RevWalk rw,
                              org.eclipse.jgit.lib.ObjectId id,
                              String pushCert)
                       throws IOException
        Throws:
        IOException
      • setRevisionForMissingCommit

        public void setRevisionForMissingCommit​(String id,
                                                String pushCert)
        Set the revision without depending on the commit being present in the repository; should only be used for converting old corrupt commits.
      • setHashtags

        public void setHashtags​(Set<String> hashtags)
      • setAssignee

        public void setAssignee​(Account.Id assignee)
      • removeAssignee

        public void removeAssignee()
      • removeReviewer

        public void removeReviewer​(Account.Id reviewer)
      • putReviewerByEmail

        public void putReviewerByEmail​(com.google.gerrit.mail.Address reviewer,
                                       ReviewerStateInternal type)
      • removeReviewerByEmail

        public void removeReviewerByEmail​(com.google.gerrit.mail.Address reviewer)
      • setPatchSetState

        public void setPatchSetState​(PatchSetState psState)
      • setCurrentPatchSet

        public void setCurrentPatchSet()
      • setGroups

        public void setGroups​(List<String> groups)
      • setRevertOf

        public void setRevertOf​(int revertOf)
      • applyImpl

        protected org.eclipse.jgit.lib.CommitBuilder applyImpl​(org.eclipse.jgit.revwalk.RevWalk rw,
                                                               org.eclipse.jgit.lib.ObjectInserter ins,
                                                               org.eclipse.jgit.lib.ObjectId curr)
                                                        throws IOException
        Description copied from class: AbstractChangeUpdate
        Create a commit containing the contents of this update.
        Specified by:
        applyImpl in class AbstractChangeUpdate
        ins - inserter to write to; callers should not flush.
        Returns:
        a new commit builder representing this commit, or null to indicate the meta ref should be deleted as a result of this update. The parent, author, and committer fields in the return value are always overwritten. The tree ID may be unset by this method, which indicates to the caller that it should be copied from the parent commit. To indicate that this update is a no-op (but this could not be determined by AbstractChangeUpdate.isEmpty()), return the sentinel AbstractChangeUpdate.NO_OP_UPDATE.
        Throws:
        IOException - if a lower-level error occurred.
      • getProjectName

        protected Project.NameKey getProjectName()
        Specified by:
        getProjectName in class AbstractChangeUpdate
        Returns:
        the NameKey for the project where the update will be stored, which is not necessarily the same as the change's project.
      • setAllowWriteToNewRef

        public void setAllowWriteToNewRef​(boolean allow)
      • setPrivate

        public void setPrivate​(boolean isPrivate)
      • setWorkInProgress

        public void setWorkInProgress​(boolean workInProgress)