Class ChangeNoteUtil
- java.lang.Object
-
- com.google.gerrit.server.notedb.ChangeNoteUtil
-
public class ChangeNoteUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChangeNoteUtil.AttentionStatusInNoteDb
Helper class for JSON serialization.static class
ChangeNoteUtil.CommitMessageRange
static class
ChangeNoteUtil.ParsedPatchSetApproval
-
Field Summary
Fields Modifier and Type Field Description static org.eclipse.jgit.revwalk.FooterKey
FOOTER_ASSIGNEE
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_ATTENTION
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_BRANCH
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_CHANGE_ID
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_CHERRY_PICK_OF
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_COMMIT
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_COPIED_LABEL
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_CURRENT
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_GROUPS
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_HASHTAGS
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_LABEL
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_PATCH_SET
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_PATCH_SET_DESCRIPTION
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_PRIVATE
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_REAL_USER
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_REVERT_OF
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_STATUS
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_SUBJECT
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_SUBMISSION_ID
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_SUBMITTED_WITH
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_TAG
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_TOPIC
static org.eclipse.jgit.revwalk.FooterKey
FOOTER_WORK_IN_PROGRESS
-
Constructor Summary
Constructors Constructor Description ChangeNoteUtil(ChangeNoteJson changeNoteJson, String serverId)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
formatAccountIdentString(Account.Id account, String accountIdAsEmail)
String
getAccountIdAsEmailAddress(Account.Id accountId)
static String
getAccountIdAsUsername(Account.Id accountId)
Returns the string"Gerrit User " + accountId
, to pseudonymize user names.ChangeNoteJson
getChangeNoteJson()
org.eclipse.jgit.lib.PersonIdent
newAccountIdIdent(Account.Id accountId, Instant when, org.eclipse.jgit.lib.PersonIdent serverIdent)
Returns aPersonIdent
that contains the account ID, but not the user's name or email address.static ChangeNoteUtil.ParsedPatchSetApproval
parseApproval(String footerLine)
ParsesChangeNoteUtil.ParsedPatchSetApproval
fromFOOTER_LABEL
line.static Optional<ChangeNoteUtil.CommitMessageRange>
parseCommitMessageRange(org.eclipse.jgit.revwalk.RevCommit commit)
static ChangeNoteUtil.ParsedPatchSetApproval
parseCopiedApproval(String labelLine)
Parses copiedChangeNoteUtil.ParsedPatchSetApproval
fromFOOTER_COPIED_LABEL
line.
-
-
-
Field Detail
-
FOOTER_ATTENTION
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_ATTENTION
-
FOOTER_ASSIGNEE
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_ASSIGNEE
-
FOOTER_BRANCH
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_BRANCH
-
FOOTER_CHANGE_ID
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_CHANGE_ID
-
FOOTER_COMMIT
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_COMMIT
-
FOOTER_CURRENT
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_CURRENT
-
FOOTER_GROUPS
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_GROUPS
-
FOOTER_HASHTAGS
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_HASHTAGS
-
FOOTER_LABEL
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_LABEL
-
FOOTER_COPIED_LABEL
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_COPIED_LABEL
-
FOOTER_PATCH_SET
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_PATCH_SET
-
FOOTER_PATCH_SET_DESCRIPTION
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_PATCH_SET_DESCRIPTION
-
FOOTER_PRIVATE
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_PRIVATE
-
FOOTER_REAL_USER
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_REAL_USER
-
FOOTER_STATUS
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_STATUS
-
FOOTER_SUBJECT
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_SUBJECT
-
FOOTER_SUBMISSION_ID
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_SUBMISSION_ID
-
FOOTER_SUBMITTED_WITH
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_SUBMITTED_WITH
-
FOOTER_TOPIC
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_TOPIC
-
FOOTER_TAG
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_TAG
-
FOOTER_WORK_IN_PROGRESS
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_WORK_IN_PROGRESS
-
FOOTER_REVERT_OF
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_REVERT_OF
-
FOOTER_CHERRY_PICK_OF
public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_CHERRY_PICK_OF
-
-
Constructor Detail
-
ChangeNoteUtil
@Inject public ChangeNoteUtil(ChangeNoteJson changeNoteJson, String serverId)
-
-
Method Detail
-
getChangeNoteJson
public ChangeNoteJson getChangeNoteJson()
-
formatAccountIdentString
public static String formatAccountIdentString(Account.Id account, String accountIdAsEmail)
-
newAccountIdIdent
public org.eclipse.jgit.lib.PersonIdent newAccountIdIdent(Account.Id accountId, Instant when, org.eclipse.jgit.lib.PersonIdent serverIdent)
Returns aPersonIdent
that contains the account ID, but not the user's name or email address.
-
getAccountIdAsUsername
public static String getAccountIdAsUsername(Account.Id accountId)
Returns the string"Gerrit User " + accountId
, to pseudonymize user names.
-
getAccountIdAsEmailAddress
public String getAccountIdAsEmailAddress(Account.Id accountId)
-
parseCommitMessageRange
public static Optional<ChangeNoteUtil.CommitMessageRange> parseCommitMessageRange(org.eclipse.jgit.revwalk.RevCommit commit)
-
parseApproval
public static ChangeNoteUtil.ParsedPatchSetApproval parseApproval(String footerLine) throws org.eclipse.jgit.errors.ConfigInvalidException
ParsesChangeNoteUtil.ParsedPatchSetApproval
fromFOOTER_LABEL
line.Valid added approval footer examples:
- Label:
Valid removed approval footer examples:
- -
- -
- -
is optional, since the approval might have been granted before PatchSetApproval.UUID
was introduced.is only persisted in cases, when the account, that granted the vote does not match the account, that issued ChangeUpdate
(created this NoteDB commit).- Throws:
org.eclipse.jgit.errors.ConfigInvalidException
-
parseCopiedApproval
public static ChangeNoteUtil.ParsedPatchSetApproval parseCopiedApproval(String labelLine) throws org.eclipse.jgit.errors.ConfigInvalidException
Parses copiedChangeNoteUtil.ParsedPatchSetApproval
fromFOOTER_COPIED_LABEL
line.Footer example: Copied-Label:
=VOTE, , :" " - ":<"TAG>"" is optional.
is also optional, if it was not set. is optional, since the approval might have been granted before PatchSetApproval.UUID
was introduced.- The label, vote, and the Gerrit account are mandatory (unlike FOOTER_LABEL where Gerrit Account is also optional since by default it's the committer).
Footer example for removal: Copied-Label: -
, is also optional, if it was not set.
- Throws:
org.eclipse.jgit.errors.ConfigInvalidException
-
-