public final class Change extends 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 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 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 Timestamp |
lastUpdatedOn
When was a meaningful modification last made to this record's data
|
protected String |
noteDbState |
protected String |
originalSubject
First line of first patch set's commit message.
|
protected Account.Id |
owner |
protected int |
rowVersion
optimistic locking
|
protected char |
status
Current state code; see
Change.Status . |
static char |
STATUS_DRAFT
Database constant for
Change.Status.DRAFT . |
static char |
STATUS_MERGED
Database constant for
Change.Status.MERGED . |
static char |
STATUS_NEW
Database constant for
Change.Status.NEW . |
protected String |
subject
Subject from the current patch set.
|
protected String |
submissionId
Unique id for the changes submitted together assigned during merging.
|
protected String |
topic
Topic name assigned by the user, if any.
|
Modifier | Constructor and Description |
---|---|
protected |
Change() |
|
Change(Change.Key newKey,
Change.Id newId,
Account.Id ownedBy,
Branch.NameKey forBranch,
Timestamp ts) |
|
Change(Change other) |
public static final char STATUS_NEW
Change.Status.NEW
.public static final char STATUS_DRAFT
Change.Status.DRAFT
.public static final char STATUS_MERGED
Change.Status.MERGED
.public static final int INITIAL_PATCH_SET_ID
public static final String CHANGE_ID_PATTERN
protected Change.Id changeId
protected Change.Key changeKey
protected int rowVersion
protected Timestamp createdOn
protected 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 String subject
protected String topic
protected String originalSubject
Unlike subject
, this string does not change if future patch sets change the first
line.
protected String submissionId
protected Account.Id assignee
protected String noteDbState
NoteDbChangeState
protected Change()
public Change(Change.Key newKey, Change.Id newId, Account.Id ownedBy, Branch.NameKey forBranch, 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 Timestamp getCreatedOn()
public void setCreatedOn(Timestamp ts)
public Timestamp getLastUpdatedOn()
public void setLastUpdatedOn(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 String getSubject()
public String getOriginalSubject()
public String getOriginalSubjectOrNull()
public PatchSet.Id currentPatchSetId()
PatchSet
in this change.public void setCurrentPatchSet(PatchSetInfo ps)
public void setCurrentPatchSet(PatchSet.Id psId, String subject, String originalSubject)
public void clearCurrentPatchSet()
public String getSubmissionId()
public void setSubmissionId(String id)
public Change.Status getStatus()
public void setStatus(Change.Status newStatus)
public String getTopic()
public void setTopic(String topic)
public String getNoteDbState()
public void setNoteDbState(String state)