Class Change
- java.lang.Object
-
- com.google.gerrit.entities.Change
-
public final class Change extends Object
A change proposed to be merged into a 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. | +-HumanComment
: comment about a specific linePatchSets
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 Classes Modifier and Type Class 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.
-
Field Summary
Fields Modifier and Type Field 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 changeprotected Change.Key
changeKey
Globally assigned unique identifier of the changeprotected PatchSet.Id
cherryPickOf
References the source change and patchset that this change was cherry-picked from.protected Timestamp
createdOn
When this change was first introduced into the database.protected int
currentPatchSetId
The current patch set.protected BranchNameKey
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 Timestamp
lastUpdatedOn
When was a meaningful modification last made to this record's dataprotected 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 lockingprotected char
status
Current state code; seeChange.Status
.static char
STATUS_MERGED
Database constant forChange.Status.MERGED
.static char
STATUS_NEW
Database constant forChange.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.protected boolean
workInProgress
Whether the change is work in progress.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Change()
Change(Change other)
Change(Change.Key newKey, Change.Id newId, Account.Id ownedBy, BranchNameKey forBranch, Timestamp ts)
-
Method Summary
-
-
-
Field Detail
-
STATUS_NEW
public static final char STATUS_NEW
Database constant forChange.Status.NEW
.- See Also:
- Constant Field Values
-
STATUS_MERGED
public static final char STATUS_MERGED
Database constant forChange.Status.MERGED
.- See Also:
- Constant Field Values
-
INITIAL_PATCH_SET_ID
public static final int INITIAL_PATCH_SET_ID
ID number of the first patch set in a change.- See Also:
- Constant Field Values
-
CHANGE_ID_PATTERN
public static final String CHANGE_ID_PATTERN
Change-Id pattern.- See Also:
- Constant Field Values
-
changeId
protected Change.Id changeId
Locally assigned unique identifier of the change
-
changeKey
protected Change.Key changeKey
Globally assigned unique identifier of the change
-
rowVersion
protected int rowVersion
optimistic locking
-
createdOn
protected Timestamp createdOn
When this change was first introduced into the database.
-
lastUpdatedOn
protected Timestamp lastUpdatedOn
When was a meaningful modification last made to this record's dataNote, this update timestamp includes its children.
-
owner
protected Account.Id owner
-
dest
protected BranchNameKey dest
The branch (and project) this change merges into.
-
status
protected char status
Current state code; seeChange.Status
.
-
currentPatchSetId
protected int currentPatchSetId
The current patch set.
-
subject
protected String subject
Subject from the current patch set.
-
topic
protected String topic
Topic name assigned by the user, if any.
-
originalSubject
protected String originalSubject
First line of first patch set's commit message.Unlike
subject
, this string does not change if future patch sets change the first line.
-
submissionId
protected String submissionId
Unique id for the changes submitted together assigned during merging. Only set if the status is MERGED.
-
assignee
protected Account.Id assignee
Allows assigning a change to a user.
-
isPrivate
protected boolean isPrivate
Whether the change is private.
-
workInProgress
protected boolean workInProgress
Whether the change is work in progress.
-
reviewStarted
protected boolean reviewStarted
Whether the change has started review.
-
revertOf
protected Change.Id revertOf
References a change that this change reverts.
-
cherryPickOf
protected PatchSet.Id cherryPickOf
References the source change and patchset that this change was cherry-picked from.
-
-
Constructor Detail
-
Change
protected Change()
-
Change
public Change(Change.Key newKey, Change.Id newId, Account.Id ownedBy, BranchNameKey forBranch, Timestamp ts)
-
Change
public Change(Change other)
-
-
Method Detail
-
id
public static Change.Id id(int id)
-
key
public static Change.Key key(String key)
-
getId
public Change.Id getId()
Legacy 32 bit integer identity for a change.
-
getChangeId
public int getChangeId()
Legacy 32 bit integer identity for a change.
-
getKey
public Change.Key getKey()
The Change-Id tag out of the initial commit, or a natural key.
-
setKey
public void setKey(Change.Key k)
-
getAssignee
public Account.Id getAssignee()
-
setAssignee
public void setAssignee(Account.Id a)
-
getCreatedOn
public Timestamp getCreatedOn()
-
setCreatedOn
public void setCreatedOn(Timestamp ts)
-
getLastUpdatedOn
public Timestamp getLastUpdatedOn()
-
setLastUpdatedOn
public void setLastUpdatedOn(Timestamp now)
-
getRowVersion
public int getRowVersion()
-
getOwner
public Account.Id getOwner()
-
setOwner
public void setOwner(Account.Id owner)
-
getDest
public BranchNameKey getDest()
-
setDest
public void setDest(BranchNameKey dest)
-
getProject
public Project.NameKey getProject()
-
getSubject
public String getSubject()
-
getOriginalSubject
public String getOriginalSubject()
-
getOriginalSubjectOrNull
public String getOriginalSubjectOrNull()
-
currentPatchSetId
public PatchSet.Id currentPatchSetId()
Get the id of the most currentPatchSet
in this change.
-
setCurrentPatchSet
public void setCurrentPatchSet(PatchSetInfo ps)
-
setCurrentPatchSet
public void setCurrentPatchSet(PatchSet.Id psId, String subject, String originalSubject)
-
clearCurrentPatchSet
public void clearCurrentPatchSet()
-
getSubmissionId
public String getSubmissionId()
-
setSubmissionId
public void setSubmissionId(String id)
-
getStatus
public Change.Status getStatus()
-
setStatus
public void setStatus(Change.Status newStatus)
-
isNew
public boolean isNew()
-
isMerged
public boolean isMerged()
-
isAbandoned
public boolean isAbandoned()
-
isClosed
public boolean isClosed()
-
getTopic
public String getTopic()
-
setTopic
public void setTopic(String topic)
-
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
public void setRevertOf(Change.Id revertOf)
-
getRevertOf
public Change.Id getRevertOf()
-
getCherryPickOf
public PatchSet.Id getCherryPickOf()
-
setCherryPickOf
public void setCherryPickOf(PatchSet.Id cherryPickOf)
-
-