Class FileHeaderUtil
- java.lang.Object
-
- com.google.gerrit.server.patch.gitfilediff.FileHeaderUtil
-
public class FileHeaderUtil extends Object
A utility class for theFileHeader
JGit object
-
-
Constructor Summary
Constructors Constructor Description FileHeaderUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Patch.ChangeType
getChangeType(org.eclipse.jgit.patch.FileHeader header)
Returns the change type associated with the file header.static com.google.common.collect.ImmutableList<String>
getHeaderLines(String header)
static com.google.common.collect.ImmutableList<String>
getHeaderLines(org.eclipse.jgit.patch.FileHeader fileHeader)
Splits theFileHeader
string to a list of strings, one string per header line.static Optional<String>
getNewPath(org.eclipse.jgit.patch.FileHeader header)
Returns the new file path associated with theFileHeader
, or empty if the file isPatch.ChangeType.DELETED
.static Optional<String>
getOldPath(org.eclipse.jgit.patch.FileHeader header)
Returns the old file path associated with theFileHeader
, or empty if the file isPatch.ChangeType.ADDED
orPatch.ChangeType.REWRITE
.static Patch.PatchType
getPatchType(org.eclipse.jgit.patch.FileHeader header)
-
-
-
Method Detail
-
getHeaderLines
public static com.google.common.collect.ImmutableList<String> getHeaderLines(org.eclipse.jgit.patch.FileHeader fileHeader)
Splits theFileHeader
string to a list of strings, one string per header line.
-
getHeaderLines
public static com.google.common.collect.ImmutableList<String> getHeaderLines(String header)
-
getOldPath
public static Optional<String> getOldPath(org.eclipse.jgit.patch.FileHeader header)
Returns the old file path associated with theFileHeader
, or empty if the file isPatch.ChangeType.ADDED
orPatch.ChangeType.REWRITE
.
-
getNewPath
public static Optional<String> getNewPath(org.eclipse.jgit.patch.FileHeader header)
Returns the new file path associated with theFileHeader
, or empty if the file isPatch.ChangeType.DELETED
.
-
getChangeType
public static Patch.ChangeType getChangeType(org.eclipse.jgit.patch.FileHeader header)
Returns the change type associated with the file header.
-
getPatchType
public static Patch.PatchType getPatchType(org.eclipse.jgit.patch.FileHeader header)
-
-