Package com.google.gerrit.server.notedb
Class AbstractChangeUpdate
- java.lang.Object
-
- com.google.gerrit.server.notedb.AbstractChangeUpdate
-
- Direct Known Subclasses:
ChangeDraftUpdate
,ChangeUpdate
,RobotCommentUpdate
public abstract class AbstractChangeUpdate extends Object
A single delta related to a specific patch-set of a change.
-
-
Field Summary
Fields Modifier and Type Field Description protected Account.Id
accountId
protected org.eclipse.jgit.lib.PersonIdent
authorIdent
protected ChangeNoteUtil
noteUtil
protected PatchSet.Id
psId
protected Account.Id
realAccountId
protected org.eclipse.jgit.lib.PersonIdent
serverIdent
protected Instant
when
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
allowWriteToNewRef()
protected abstract org.eclipse.jgit.lib.CommitBuilder
applyImpl(org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, org.eclipse.jgit.lib.ObjectId curr)
Create a commit containing the contents of this update.protected boolean
bypassMaxUpdates()
Whether to allow bypassing the check that an update does not exceed the max update count on an object.Account.Id
getAccountId()
Change
getChange()
Change.Id
getId()
ChangeNotes
getNotes()
Returns notes for the state of this change prior to this update.Account.Id
getNullableAccountId()
PatchSet.Id
getPatchSetId()
protected abstract Project.NameKey
getProjectName()
Returns the NameKey for the project where the update will be stored, which is not necessarily the same as the change's project.protected abstract String
getRefName()
Instant
getWhen()
abstract boolean
isEmpty()
Whether no updates have been done.protected void
setParentCommit(org.eclipse.jgit.lib.CommitBuilder cb, org.eclipse.jgit.lib.ObjectId parentCommitId)
void
setPatchSetId(PatchSet.Id psId)
-
-
-
Field Detail
-
noteUtil
protected final ChangeNoteUtil noteUtil
-
accountId
protected final Account.Id accountId
-
realAccountId
protected final Account.Id realAccountId
-
authorIdent
protected final org.eclipse.jgit.lib.PersonIdent authorIdent
-
when
protected final Instant when
-
serverIdent
protected final org.eclipse.jgit.lib.PersonIdent serverIdent
-
psId
protected PatchSet.Id psId
-
-
Method Detail
-
getId
public Change.Id getId()
-
getNotes
public ChangeNotes getNotes()
Returns notes for the state of this change prior to this update. If this update is part of a series managed by aNoteDbUpdateManager
, then this reflects the state prior to the first update in the series. A null return value can only happen when the change is being rebuilt from NoteDb. A change that is in the process of being created will result in a non-null return value from this method, but a null return value fromAbstractChangeNotes.getRevision()
.
-
getChange
public Change getChange()
-
getWhen
public Instant getWhen()
-
getPatchSetId
public PatchSet.Id getPatchSetId()
-
setPatchSetId
public void setPatchSetId(PatchSet.Id psId)
-
getAccountId
public Account.Id getAccountId()
-
getNullableAccountId
public Account.Id getNullableAccountId()
-
isEmpty
public abstract boolean isEmpty()
Whether no updates have been done.
-
getProjectName
protected abstract Project.NameKey getProjectName()
Returns the NameKey for the project where the update will be stored, which is not necessarily the same as the change's project.
-
getRefName
protected abstract String getRefName()
-
setParentCommit
protected void setParentCommit(org.eclipse.jgit.lib.CommitBuilder cb, org.eclipse.jgit.lib.ObjectId parentCommitId)
-
bypassMaxUpdates
protected boolean bypassMaxUpdates()
Whether to allow bypassing the check that an update does not exceed the max update count on an object.
-
applyImpl
protected abstract 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
Create a commit containing the contents of this update.- Parameters:
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
isEmpty()
), return the sentinelNO_OP_UPDATE
. - Throws:
IOException
- if a lower-level error occurred.
-
allowWriteToNewRef
public boolean allowWriteToNewRef()
-
-