public class ChangeUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.collect.Ordering<PatchSet> |
PS_ID_ORDER |
static int |
TOPIC_MAX_LENGTH |
Modifier and Type | Method and Description |
---|---|
static void |
ensureChangeIdIsCorrect(boolean requireChangeId,
java.lang.String currentChangeId,
java.lang.String newCommitMessage)
Make sure that the change commit message has a correct footer.
|
static java.lang.String |
messageUuid() |
static PatchSet.Id |
nextPatchSetId(PatchSet.Id 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 |
nextPatchSetIdFromAllRefsMap(java.util.Map<java.lang.String,org.eclipse.jgit.lib.Ref> allRefs,
PatchSet.Id id)
Get the next patch set ID from a previously-read map of all refs.
|
static PatchSet.Id |
nextPatchSetIdFromChangeRefsMap(java.util.Map<java.lang.String,org.eclipse.jgit.lib.ObjectId> changeRefs,
PatchSet.Id id)
Get the next patch set ID from a previously-read map of refs below the change prefix.
|
static java.lang.String |
status(Change c) |
public static final int TOPIC_MAX_LENGTH
public static final com.google.common.collect.Ordering<PatchSet> PS_ID_ORDER
public static java.lang.String messageUuid()
public static PatchSet.Id nextPatchSetIdFromAllRefsMap(java.util.Map<java.lang.String,org.eclipse.jgit.lib.Ref> allRefs, PatchSet.Id id)
allRefs
- map of full ref name to ref.id
- previous patch set ID.allRefs
map.public static PatchSet.Id nextPatchSetIdFromChangeRefsMap(java.util.Map<java.lang.String,org.eclipse.jgit.lib.ObjectId> changeRefs, PatchSet.Id id)
changeRefs
- map of ref suffix to SHA-1, where the keys are ref names with the refs/changes/CD/ABCD/
prefix stripped. All refs should be under id
's change ref
prefix.id
- previous patch set ID.changeRefs
map.public static PatchSet.Id nextPatchSetId(PatchSet.Id id)
This patch set ID may or may not be available in the database; callers that want a
previously-unused ID should use nextPatchSetIdFromAllRefsMap(java.util.Map<java.lang.String, org.eclipse.jgit.lib.Ref>, com.google.gerrit.reviewdb.client.PatchSet.Id)
or nextPatchSetIdFromChangeRefsMap(java.util.Map<java.lang.String, org.eclipse.jgit.lib.ObjectId>, com.google.gerrit.reviewdb.client.PatchSet.Id)
.
id
- previous patch set ID.public static PatchSet.Id nextPatchSetId(org.eclipse.jgit.lib.Repository git, PatchSet.Id id) throws java.io.IOException
git
- repository to scan for patch set refs.id
- previous patch set ID.java.io.IOException
public static void ensureChangeIdIsCorrect(boolean requireChangeId, java.lang.String currentChangeId, java.lang.String newCommitMessage) throws ResourceConflictException, BadRequestException
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 changeResourceConflictException
- if the new commit message has a missing or invalid Change-IdBadRequestException
- if the new commit message is null or emptypublic static java.lang.String status(Change c)