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)
      • fixStatusToMerged

        public void fixStatusToMerged​(SubmissionId submissionId)
      • putApproval

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

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

        public void removeApprovalFor​(Account.Id reviewer,
                                      String label)
      • 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​(HumanComment c)
      • deleteCommentByRewritingHistory

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

        public void deleteChangeMessageByRewritingHistory​(String targetMessageId,
                                                          String newMessage)
      • 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
      • setHashtags

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

        public void addToPlannedAttentionSetUpdates​(Set<AttentionSetUpdate> updates)
        All updates must have a timestamp of null since we use the commit's timestamp. There also must not be multiple updates for a single user. Only the first update takes place because of the different priorities: e.g, if we want to add someone to the attention set but also want to remove someone from the attention set, we should ensure to add/remove that user based on the priority of the addition and removal. If most importantly we want to remove the user, then we must first create the removal, and the addition will not take effect.
      • addToPlannedAttentionSetUpdates

        public void addToPlannedAttentionSetUpdates​(AttentionSetUpdate update)
      • setAssignee

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

        public void removeAssignee()
      • removeReviewer

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

        public void removeReviewerByEmail​(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)
      • setCherryPickOf

        public void setCherryPickOf​(String cherryPickOf)
      • 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.
      • ignoreFurtherAttentionSetUpdates

        public void ignoreFurtherAttentionSetUpdates()
        When set, default attention set rules are ignored (E.g, adding reviewers -> adds to attention set, etc).
      • 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)