Package com.google.gerrit.server
Class ChangeUtil
java.lang.Object
com.google.gerrit.server.ChangeUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.collect.Ordering<PatchSet>
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
ensureChangeIdIsCorrect
(boolean requireChangeId, String currentChangeId, String newCommitMessage) Make sure that the change commit message has a correct footer.getChangeIdsFromFooter
(org.eclipse.jgit.revwalk.RevCommit c) static String
Returns a new unique identifier for change message entities.static PatchSet.Id
Get the next patch set ID just looking at a single previous patch set ID.static PatchSet.Id
nextPatchSetId
(org.eclipse.jgit.lib.Repository git, PatchSet.Id id) Get the next patch set ID from scanning refs in the repo.static PatchSet.Id
nextPatchSetIdFromChangeRefs
(Collection<String> changeRefNames, PatchSet.Id id) Get the next patch set ID from a previously-read map of refs below the change prefix.static String
-
Field Details
-
TOPIC_MAX_LENGTH
public static final int TOPIC_MAX_LENGTH- See Also:
-
PS_ID_ORDER
-
-
Method Details
-
messageUuid
Returns a new unique identifier for change message entities. -
nextPatchSetIdFromChangeRefs
public static PatchSet.Id nextPatchSetIdFromChangeRefs(Collection<String> changeRefNames, PatchSet.Id id) Get the next patch set ID from a previously-read map of refs below the change prefix.- Parameters:
changeRefNames
- existing full change ref names with the same change ID asid
.id
- previous patch set ID.- Returns:
- next unused patch set ID for the same change, skipping any IDs whose corresponding ref
names appear in the
changeRefs
map.
-
nextPatchSetId
Get the next patch set ID just looking at a single previous patch set ID.This patch set ID may or may not be available in the database.
- Parameters:
id
- previous patch set ID.- Returns:
- next patch set ID for the same change, incrementing by 1.
-
nextPatchSetId
public static PatchSet.Id nextPatchSetId(org.eclipse.jgit.lib.Repository git, PatchSet.Id id) throws IOException Get the next patch set ID from scanning refs in the repo.- Parameters:
git
- repository to scan for patch set refs.id
- previous patch set ID.- Returns:
- next unused patch set ID for the same change, skipping any IDs whose corresponding ref names appear in the repository.
- Throws:
IOException
-
ensureChangeIdIsCorrect
public void ensureChangeIdIsCorrect(boolean requireChangeId, String currentChangeId, String newCommitMessage) throws ResourceConflictException, BadRequestException Make sure that the change commit message has a correct footer.- Parameters:
requireChangeId
- true if Change-Id is a mandatory footer for the projectcurrentChangeId
- current Change-Id value before the commit message is updatednewCommitMessage
- new commit message for the change- Throws:
ResourceConflictException
- if the new commit message has a missing or invalid Change-IdBadRequestException
- if the new commit message is null or empty
-
status
-