Package com.google.gerrit.server
Class ChangeUtil
- java.lang.Object
-
- com.google.gerrit.server.ChangeUtil
-
public class ChangeUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.Ordering<PatchSet>
PS_ID_ORDER
static int
TOPIC_MAX_LENGTH
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
cropSubject(String subject)
static String
formatChangeUrl(String canonicalWebUrl, Change change)
static 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(Map<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(Map<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 String
status(Change c)
-
-
-
Field Detail
-
TOPIC_MAX_LENGTH
public static final int TOPIC_MAX_LENGTH
- See Also:
- Constant Field Values
-
PS_ID_ORDER
public static final com.google.common.collect.Ordering<PatchSet> PS_ID_ORDER
-
-
Method Detail
-
messageUuid
public static String messageUuid()
- Returns:
- a new unique identifier for change message entities.
-
nextPatchSetIdFromAllRefsMap
public static PatchSet.Id nextPatchSetIdFromAllRefsMap(Map<String,org.eclipse.jgit.lib.Ref> allRefs, PatchSet.Id id)
Get the next patch set ID from a previously-read map of all refs.- Parameters:
allRefs
- map of full ref name to ref, in the same format returned byRefDatabase.getRefs(String)
when passing""
.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
allRefs
map.
-
nextPatchSetIdFromChangeRefsMap
public static PatchSet.Id nextPatchSetIdFromChangeRefsMap(Map<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.- Parameters:
changeRefs
- map of ref suffix to SHA-1, where the keys are ref names with therefs/changes/CD/ABCD/
prefix stripped. All refs should be underid
's change ref prefix. The keys match the format returned byRefDatabase.getRefs(String)
when passing the appropriaterefs/changes/CD/ABCD
.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
public static PatchSet.Id nextPatchSetId(PatchSet.Id id)
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; 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)
ornextPatchSetIdFromChangeRefsMap(java.util.Map<java.lang.String, org.eclipse.jgit.lib.ObjectId>, com.google.gerrit.reviewdb.client.PatchSet.Id)
.- 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
-
-