Class FileDiffOutput
- java.lang.Object
-
- com.google.gerrit.server.patch.filediff.FileDiffOutput
-
- All Implemented Interfaces:
Serializable
public abstract class FileDiffOutput extends Object implements Serializable
File diff for a single file path. Produced as output of theFileDiffCache
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileDiffOutput.Builder
static class
FileDiffOutput.Serializer
-
Constructor Summary
Constructors Constructor Description FileDiffOutput()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
allEditsDueToRebase()
A boolean indicating if all underlying edits of the file diff are due to rebase.static FileDiffOutput.Builder
builder()
abstract Patch.ChangeType
changeType()
The change type of the underlying file, e.g.abstract ComparisonType
comparisonType()
Comparison type of old and new commits: against another patchset, parent or auto-merge.static FileDiffOutput
createNegative(String filePath, org.eclipse.jgit.lib.ObjectId oldCommitId, org.eclipse.jgit.lib.ObjectId newCommitId)
Create a negative file diff.int
deletions()
Returns the number of deleted lines for the file diff.abstract com.google.common.collect.ImmutableList<TaggedEdit>
edits()
The list of edits resulting from the diff hunks of the file.static FileDiffOutput
empty(String filePath, org.eclipse.jgit.lib.ObjectId oldCommitId, org.eclipse.jgit.lib.ObjectId newCommitId)
Returns an entity representing an unchanged file between two commits.abstract com.google.common.collect.ImmutableList<String>
headerLines()
A list of strings representation of the header lines of theFileHeader
that is produced as output of the diff.int
insertions()
Returns the number of inserted lines for the file diff.boolean
isEmpty()
Returns true if this entity represents an unchanged file between two commits.boolean
isNegative()
Returnstrue
if the diff computation was not able to compute a diff.abstract Optional<Boolean>
negative()
Returnstrue
if the diff computation was not able to compute a diff, i.e.abstract org.eclipse.jgit.lib.ObjectId
newCommitId()
The 20 bytes SHA-1 object ID of the new git commit used in the diff.abstract Optional<String>
newPath()
The file path at the new commit.abstract org.eclipse.jgit.lib.ObjectId
oldCommitId()
The 20 bytes SHA-1 object ID of the old git commit used in the diff, orObjectId.zeroId()
ifnewCommitId()
was a root commit.abstract Optional<String>
oldPath()
The file path at the old commit.abstract Optional<Patch.PatchType>
patchType()
The patch type of the underlying file, e.g.abstract long
size()
The file size at the new commit.abstract long
sizeDelta()
Difference in file size between the old and new commits.abstract FileDiffOutput.Builder
toBuilder()
int
weight()
-
-
-
Method Detail
-
oldCommitId
public abstract org.eclipse.jgit.lib.ObjectId oldCommitId()
The 20 bytes SHA-1 object ID of the old git commit used in the diff, orObjectId.zeroId()
ifnewCommitId()
was a root commit.
-
newCommitId
public abstract org.eclipse.jgit.lib.ObjectId newCommitId()
The 20 bytes SHA-1 object ID of the new git commit used in the diff.
-
comparisonType
public abstract ComparisonType comparisonType()
Comparison type of old and new commits: against another patchset, parent or auto-merge.
-
oldPath
public abstract Optional<String> oldPath()
The file path at the old commit. Returns an empty Optional ifchangeType()
is equal toPatch.ChangeType.ADDED
.
-
newPath
public abstract Optional<String> newPath()
The file path at the new commit. Returns an empty optional ifchangeType()
is equal toPatch.ChangeType.DELETED
.
-
changeType
public abstract Patch.ChangeType changeType()
The change type of the underlying file, e.g. added, deleted, renamed, etc...
-
patchType
public abstract Optional<Patch.PatchType> patchType()
The patch type of the underlying file, e.g. unified, binary , etc...
-
headerLines
public abstract com.google.common.collect.ImmutableList<String> headerLines()
A list of strings representation of the header lines of theFileHeader
that is produced as output of the diff.
-
edits
public abstract com.google.common.collect.ImmutableList<TaggedEdit> edits()
The list of edits resulting from the diff hunks of the file.
-
size
public abstract long size()
The file size at the new commit.
-
sizeDelta
public abstract long sizeDelta()
Difference in file size between the old and new commits.
-
negative
public abstract Optional<Boolean> negative()
Returnstrue
if the diff computation was not able to compute a diff, i.e. for diffs taking a very long time to compute. We cache negative result in this case.
-
toBuilder
public abstract FileDiffOutput.Builder toBuilder()
-
allEditsDueToRebase
public boolean allEditsDueToRebase()
A boolean indicating if all underlying edits of the file diff are due to rebase.
-
insertions
public int insertions()
Returns the number of inserted lines for the file diff.
-
deletions
public int deletions()
Returns the number of deleted lines for the file diff.
-
empty
public static FileDiffOutput empty(String filePath, org.eclipse.jgit.lib.ObjectId oldCommitId, org.eclipse.jgit.lib.ObjectId newCommitId)
Returns an entity representing an unchanged file between two commits.
-
createNegative
public static FileDiffOutput createNegative(String filePath, org.eclipse.jgit.lib.ObjectId oldCommitId, org.eclipse.jgit.lib.ObjectId newCommitId)
Create a negative file diff. We use this to cache negative diffs for entries that result in timeouts.
-
isEmpty
public boolean isEmpty()
Returns true if this entity represents an unchanged file between two commits.
-
isNegative
public boolean isNegative()
Returnstrue
if the diff computation was not able to compute a diff. We cache negative result in this case.
-
builder
public static FileDiffOutput.Builder builder()
-
weight
public int weight()
-
-