Package com.google.gerrit.server
Class ChangeMessagesUtil
java.lang.Object
com.google.gerrit.server.ChangeMessagesUtil
Utility functions to manipulate
ChangeMessage
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionbyChange
(ChangeNotes notes) ReturnsChangeMessage
s fromChangeNotes
, loadsChangeNotes
from data storage (cache or NoteDB), if it was not loaded yet.static ChangeMessageInfo
createChangeMessageInfo
(ChangeMessage message, AccountLoader accountLoader) createChangeMessageInfoWithReplacedTemplates
(ChangeMessage message, AccountLoader accountLoader) ChangeMessage
is served in template form toChangeApi
.static boolean
isAutogenerated
(String tag) Determines whether the tag starts with the autogenerated prefixstatic boolean
void
replaceChangeMessage
(ChangeUpdate update, String targetMessageId, String newMessage) Replace an existing change message with the provided new message.setChangeMessage
(ChangeUpdate update, String messageTemplate, String tag) SetsmessageTemplate
andtag
, that should be applied by theupdate
.setChangeMessage
(ChangeContext ctx, String messageTemplate, String tag) static String
uploadedPatchSetTag
(boolean workInProgress)
-
Field Details
-
AUTOGENERATED_TAG_PREFIX
- See Also:
-
AUTOGENERATED_BY_GERRIT_TAG_PREFIX
- See Also:
-
TAG_ABANDON
- See Also:
-
TAG_CHERRY_PICK_CHANGE
- See Also:
-
TAG_DELETE_REVIEWER
- See Also:
-
TAG_DELETE_VOTE
- See Also:
-
TAG_MERGED
- See Also:
-
TAG_MOVE
- See Also:
-
TAG_RESTORE
- See Also:
-
TAG_REVERT
- See Also:
-
TAG_UPDATE_ATTENTION_SET
- See Also:
-
TAG_SET_DESCRIPTION
- See Also:
-
TAG_SET_HASHTAGS
- See Also:
-
TAG_SET_PRIVATE
- See Also:
-
TAG_SET_READY
- See Also:
-
TAG_SET_TOPIC
- See Also:
-
TAG_SET_WIP
- See Also:
-
TAG_UNSET_PRIVATE
- See Also:
-
TAG_UPLOADED_PATCH_SET
- See Also:
-
TAG_UPLOADED_WIP_PATCH_SET
- See Also:
-
-
Method Details
-
setChangeMessage
SetsmessageTemplate
andtag
, that should be applied by theupdate
.The
messageTemplate
is persisted in storage and should not contain user identifiable information. SeeChangeMessage
.- Parameters:
update
- update that setsmessageTemplate
.messageTemplate
- message in template form, that should be applied by the update.tag
- tag that should be applied by the update.- Returns:
- message built from
messageTemplate
. Templates are replaced, so it might contain user identifiable information.
-
setChangeMessage
-
uploadedPatchSetTag
-
byChange
ReturnsChangeMessage
s fromChangeNotes
, loadsChangeNotes
from data storage (cache or NoteDB), if it was not loaded yet. -
replaceChangeMessage
Replace an existing change message with the provided new message.The ID of a change message is different between NoteDb and ReviewDb. In NoteDb, it's the commit SHA-1, but in ReviewDb it was generated randomly. Taking the target message as an index rather than an ID allowed us to delete the message from both NoteDb and ReviewDb.
- Parameters:
update
- change update.targetMessageId
- the id of the target change message.newMessage
- the new message which is going to replace the old.
-
isAutogenerated
Determines whether the tag starts with the autogenerated prefix- Parameters:
tag
- value of a tag, or null.
-
isAutogeneratedByGerrit
-
createChangeMessageInfo
public static ChangeMessageInfo createChangeMessageInfo(ChangeMessage message, AccountLoader accountLoader) -
createChangeMessageInfoWithReplacedTemplates
public ChangeMessageInfo createChangeMessageInfoWithReplacedTemplates(ChangeMessage message, AccountLoader accountLoader) ChangeMessage
is served in template form toChangeApi
. Serve message with replaced templates to the legacyChangeMessageApi
endpoints. TODO(mariasavtchouk): remove this, afterChangeMessageApi
is deprecated (gate with experiment).
-