Class Change
The data graph rooted below a Change can be quite complex:
Change
| +-ChangeMessage
: "cover letter" or general comment. | +-PatchSet
: a single variant of this change. | +-PatchSetApproval
: a +/- vote on the change's current state. | +-HumanComment
: comment about a specific line
PatchSets
Every change has at least one PatchSet. A change starts out with one PatchSet, the initial
proposal put forth by the change owner. This Account
is usually also listed as the author
and committer in the PatchSetInfo.
Each PatchSet contains zero or more Patch records, detailing the file paths impacted by the change (otherwise known as, the file paths the author added/deleted/modified). Sometimes a merge commit can contain zero patches, if the merge has no conflicts, or has no impact other than to cut off a line of development.
Each Comment is a draft or a published comment about a single line of the associated file. These are the inline comment entities created by users as they perform a review.
When additional PatchSets appear under a change, these PatchSets reference replacement commits; alternative commits that could be made to the project instead of the original commit referenced by the first PatchSet.
A change has at most one current PatchSet. The current PatchSet is updated when a new replacement PatchSet is uploaded. When a change is submitted, the current patch set is what is merged into the destination branch.
ChangeMessage
The ChangeMessage entity is a general free-form comment about the whole change, rather than Comment's file and line specific context. The ChangeMessage appears at the start of any email generated by Gerrit, and is shown on the change overview page, rather than in a file-specific context. Users often use this entity to describe general remarks about the overall concept proposed by the change.
PatchSetApproval
PatchSetApproval entities exist to fill in the cells of the approvals table in the web
UI. That is, a single PatchSetApproval record's key is the tuple
(PatchSet,Account,ApprovalCategory)
. Each PatchSetApproval carries with it a small score value,
typically within the range -2..+2.
If an Account has created only PatchSetApprovals with a score value of 0, the Change shows in
their dashboard, and they are said to be CC'd (carbon copied) on the Change, but are not a direct
reviewer. This often happens when an account was specified at upload time with the --cc
command line flag, or have published comments, but left the approval scores at 0 ("No Score").
If an Account has one or more PatchSetApprovals with a score != 0, the Change shows in their dashboard, and they are said to be an active reviewer. Such individuals are highlighted when notice of a replacement patch set is sent, or when notice of the change submission occurs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The numeric change IDstatic class
Globally unique identification of this change.static enum
Current state within the basic workflow of the change. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Change-Id pattern.static final int
ID number of the first patch set in a change.static final char
Database constant forChange.Status.MERGED
.static final char
Database constant forChange.Status.NEW
. -
Constructor Summary
ConstructorsConstructorDescriptionChange
(Change.Key newKey, Change.Id newId, Account.Id ownedBy, BranchNameKey forBranch, Instant ts) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Get the id of the most currentPatchSet
in this change.int
32 bit integer identity for a change.getDest()
getId()
32 bit integer identity for a change.getKey()
The Change-Id tag out of the initial commit, or a natural key.getOwner()
ServerId of the Gerrit instance that created the change.getTopic()
boolean
static Change.Id
id
(int id) boolean
boolean
isClosed()
boolean
isMerged()
boolean
isNew()
boolean
boolean
static Change.Key
void
setCherryPickOf
(PatchSet.Id cherryPickOf) void
setCreatedOn
(Instant ts) void
setCurrentPatchSet
(PatchSet.Id psId, String subject, String originalSubject) void
void
setDest
(BranchNameKey dest) void
setKey
(Change.Key k) void
setLastUpdatedOn
(Instant now) void
setOwner
(Account.Id owner) void
setPrivate
(boolean isPrivate) void
setRevertOf
(Change.Id revertOf) void
setReviewStarted
(boolean reviewStarted) void
setServerId
(String serverId) Set the serverId of the Gerrit instance that created the change.void
setStatus
(Change.Status newStatus) void
void
void
setWorkInProgress
(boolean workInProgress) toString()
-
Field Details
-
STATUS_NEW
public static final char STATUS_NEWDatabase constant forChange.Status.NEW
.- See Also:
-
STATUS_MERGED
public static final char STATUS_MERGEDDatabase constant forChange.Status.MERGED
.- See Also:
-
INITIAL_PATCH_SET_ID
public static final int INITIAL_PATCH_SET_IDID number of the first patch set in a change.- See Also:
-
CHANGE_ID_PATTERN
Change-Id pattern.- See Also:
-
-
Constructor Details
-
Change
public Change(Change.Key newKey, Change.Id newId, Account.Id ownedBy, BranchNameKey forBranch, Instant ts) -
Change
-
-
Method Details
-
id
-
key
-
getId
32 bit integer identity for a change. -
setServerId
Set the serverId of the Gerrit instance that created the change. It can be set to null for testing purposes in the protobuf converter tests. -
getServerId
ServerId of the Gerrit instance that created the change. It could be null when the change is not fetched from NoteDb but obtained through protobuf deserialisation. -
getChangeId
public int getChangeId()32 bit integer identity for a change. -
getKey
The Change-Id tag out of the initial commit, or a natural key. -
setKey
-
getCreatedOn
-
setCreatedOn
-
getLastUpdatedOn
-
setLastUpdatedOn
-
getOwner
-
setOwner
-
getDest
-
setDest
-
getProject
-
getSubject
-
getOriginalSubject
-
getOriginalSubjectOrNull
-
currentPatchSetId
Get the id of the most currentPatchSet
in this change. -
setCurrentPatchSet
-
setCurrentPatchSet
-
clearCurrentPatchSet
public void clearCurrentPatchSet() -
getSubmissionId
-
setSubmissionId
-
getStatus
-
setStatus
-
isNew
public boolean isNew() -
isMerged
public boolean isMerged() -
isAbandoned
public boolean isAbandoned() -
isClosed
public boolean isClosed() -
getTopic
-
setTopic
-
isPrivate
public boolean isPrivate() -
setPrivate
public void setPrivate(boolean isPrivate) -
isWorkInProgress
public boolean isWorkInProgress() -
setWorkInProgress
public void setWorkInProgress(boolean workInProgress) -
hasReviewStarted
public boolean hasReviewStarted() -
setReviewStarted
public void setReviewStarted(boolean reviewStarted) -
setRevertOf
-
getRevertOf
-
getCherryPickOf
-
setCherryPickOf
-
toString
-