Package com.google.gerrit.server.notedb
Class AbstractChangeUpdate
java.lang.Object
com.google.gerrit.server.notedb.AbstractChangeUpdate
- Direct Known Subclasses:
ChangeDraftNotesUpdate
,ChangeUpdate
,RobotCommentUpdate
A single delta related to a specific patch-set of a change.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Account.Id
protected final org.eclipse.jgit.lib.PersonIdent
protected final ChangeNoteUtil
protected PatchSet.Id
protected final Account.Id
protected final org.eclipse.jgit.lib.PersonIdent
protected final Instant
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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
Whether to allow bypassing the check that an update does not exceed the max update count on an object.getId()
getNotes()
Returns notes for the state of this change prior to this update.protected abstract Project.NameKey
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
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 Details
-
noteUtil
-
accountId
-
realAccountId
-
authorIdent
protected final org.eclipse.jgit.lib.PersonIdent authorIdent -
when
-
serverIdent
protected final org.eclipse.jgit.lib.PersonIdent serverIdent -
psId
-
-
Method Details
-
getId
-
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
-
getWhen
-
getPatchSetId
-
setPatchSetId
-
getAccountId
-
getNullableAccountId
-
getRealAccountId
-
isEmpty
public abstract boolean isEmpty()Whether no updates have been done. -
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
-
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()
-