public final class Change
extends java.lang.Object
Branch
.
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. | +-PatchLineComment
: comment about a specific line
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 PatchLineComment 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.
The ChangeMessage entity is a general free-form comment about the whole change, rather than PatchLineComment'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 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.
Modifier and Type | Class and Description |
---|---|
static class |
Change.Id |
static class |
Change.Key
Globally unique identification of this change.
|
static class |
Change.Status
Current state within the basic workflow of the change.
|
Modifier and Type | Field and Description |
---|---|
protected Account.Id |
assignee
Allows assigning a change to a user.
|
static java.lang.String |
CHANGE_ID_PATTERN
Change-Id pattern.
|
protected Change.Id |
changeId
Locally assigned unique identifier of the change
|
protected Change.Key |
changeKey
Globally assigned unique identifier of the change
|
protected java.sql.Timestamp |
createdOn
When this change was first introduced into the database.
|
protected int |
currentPatchSetId
The current patch set.
|
protected Branch.NameKey |
dest
The branch (and project) this change merges into.
|
static int |
INITIAL_PATCH_SET_ID
ID number of the first patch set in a change.
|
protected boolean |
isPrivate
Whether the change is private.
|
protected java.sql.Timestamp |
lastUpdatedOn
When was a meaningful modification last made to this record's data
|
protected java.lang.String |
noteDbState |
protected java.lang.String |
originalSubject
First line of first patch set's commit message.
|
protected Account.Id |
owner |
protected Change.Id |
revertOf
References a change that this change reverts.
|
protected boolean |
reviewStarted
Whether the change has started review.
|
protected int |
rowVersion
optimistic locking
|
protected char |
status
Current state code; see
Change.Status . |
static char |
STATUS_MERGED
Database constant for
Change.Status.MERGED . |
static char |
STATUS_NEW
Database constant for
Change.Status.NEW . |
protected java.lang.String |
subject
Subject from the current patch set.
|
protected java.lang.String |
submissionId
Unique id for the changes submitted together assigned during merging.
|
protected java.lang.String |
topic
Topic name assigned by the user, if any.
|
protected boolean |
workInProgress
Whether the change is work in progress.
|
Modifier | Constructor and Description |
---|---|
protected |
Change() |
|
Change(Change.Key newKey,
Change.Id newId,
Account.Id ownedBy,
Branch.NameKey forBranch,
java.sql.Timestamp ts) |
|
Change(Change other) |
Modifier and Type | Method and Description |
---|---|
void |
clearCurrentPatchSet() |
PatchSet.Id |
currentPatchSetId()
Get the id of the most current
PatchSet in this change. |
Account.Id |
getAssignee() |
int |
getChangeId()
Legacy 32 bit integer identity for a change.
|
java.sql.Timestamp |
getCreatedOn() |
Branch.NameKey |
getDest() |
Change.Id |
getId()
Legacy 32 bit integer identity for a change.
|
Change.Key |
getKey()
The Change-Id tag out of the initial commit, or a natural key.
|
java.sql.Timestamp |
getLastUpdatedOn() |
java.lang.String |
getNoteDbState() |
java.lang.String |
getOriginalSubject() |
java.lang.String |
getOriginalSubjectOrNull() |
Account.Id |
getOwner() |
Project.NameKey |
getProject() |
Change.Id |
getRevertOf() |
int |
getRowVersion() |
Change.Status |
getStatus() |
java.lang.String |
getSubject() |
java.lang.String |
getSubmissionId() |
java.lang.String |
getTopic() |
boolean |
hasReviewStarted() |
boolean |
isPrivate() |
boolean |
isWorkInProgress() |
void |
setAssignee(Account.Id a) |
void |
setCreatedOn(java.sql.Timestamp ts) |
void |
setCurrentPatchSet(PatchSet.Id psId,
java.lang.String subject,
java.lang.String originalSubject) |
void |
setCurrentPatchSet(PatchSetInfo ps) |
void |
setDest(Branch.NameKey dest) |
void |
setKey(Change.Key k) |
void |
setLastUpdatedOn(java.sql.Timestamp now) |
void |
setNoteDbState(java.lang.String state) |
void |
setOwner(Account.Id owner) |
void |
setPrivate(boolean isPrivate) |
void |
setRevertOf(Change.Id revertOf) |
void |
setReviewStarted(boolean reviewStarted) |
void |
setStatus(Change.Status newStatus) |
void |
setSubmissionId(java.lang.String id) |
void |
setTopic(java.lang.String topic) |
void |
setWorkInProgress(boolean workInProgress) |
java.lang.String |
toString() |
public static final char STATUS_NEW
Change.Status.NEW
.public static final char STATUS_MERGED
Change.Status.MERGED
.public static final int INITIAL_PATCH_SET_ID
public static final java.lang.String CHANGE_ID_PATTERN
protected Change.Id changeId
protected Change.Key changeKey
protected int rowVersion
protected java.sql.Timestamp createdOn
protected java.sql.Timestamp lastUpdatedOn
Note, this update timestamp includes its children.
protected Account.Id owner
protected Branch.NameKey dest
protected char status
Change.Status
.protected int currentPatchSetId
protected java.lang.String subject
protected java.lang.String topic
protected java.lang.String originalSubject
Unlike subject
, this string does not change if future patch sets change the first
line.
protected java.lang.String submissionId
protected Account.Id assignee
protected boolean isPrivate
protected boolean workInProgress
protected boolean reviewStarted
protected Change.Id revertOf
protected java.lang.String noteDbState
NoteDbChangeState
protected Change()
public Change(Change.Key newKey, Change.Id newId, Account.Id ownedBy, Branch.NameKey forBranch, java.sql.Timestamp ts)
public Change(Change other)
public Change.Id getId()
public int getChangeId()
public Change.Key getKey()
public void setKey(Change.Key k)
public Account.Id getAssignee()
public void setAssignee(Account.Id a)
public java.sql.Timestamp getCreatedOn()
public void setCreatedOn(java.sql.Timestamp ts)
public java.sql.Timestamp getLastUpdatedOn()
public void setLastUpdatedOn(java.sql.Timestamp now)
public int getRowVersion()
public Account.Id getOwner()
public void setOwner(Account.Id owner)
public Branch.NameKey getDest()
public void setDest(Branch.NameKey dest)
public Project.NameKey getProject()
public java.lang.String getSubject()
public java.lang.String getOriginalSubject()
public java.lang.String getOriginalSubjectOrNull()
public PatchSet.Id currentPatchSetId()
PatchSet
in this change.public void setCurrentPatchSet(PatchSetInfo ps)
public void setCurrentPatchSet(PatchSet.Id psId, java.lang.String subject, java.lang.String originalSubject)
public void clearCurrentPatchSet()
public java.lang.String getSubmissionId()
public void setSubmissionId(java.lang.String id)
public Change.Status getStatus()
public void setStatus(Change.Status newStatus)
public java.lang.String getTopic()
public void setTopic(java.lang.String topic)
public boolean isPrivate()
public void setPrivate(boolean isPrivate)
public boolean isWorkInProgress()
public void setWorkInProgress(boolean workInProgress)
public boolean hasReviewStarted()
public void setReviewStarted(boolean reviewStarted)
public void setRevertOf(Change.Id revertOf)
public Change.Id getRevertOf()
public java.lang.String getNoteDbState()
public void setNoteDbState(java.lang.String state)
public java.lang.String toString()
toString
in class java.lang.Object