Class GitFileDiff

java.lang.Object
com.google.gerrit.server.patch.gitfilediff.GitFileDiff

public abstract class GitFileDiff extends Object
Entity representing a modified file (added, deleted, modified, renamed, etc...) between two different git commits.
  • Constructor Details

    • GitFileDiff

      public GitFileDiff()
  • Method Details

    • edits

      public abstract com.google.common.collect.ImmutableList<Edit> edits()
      An ImmutableList of the modified regions in the file.
    • fileHeader

      public abstract String fileHeader()
      A string representation of the FileHeader.
    • oldPath

      public abstract Optional<String> oldPath()
      The file name at the old git tree identified by oldId()
    • newPath

      public abstract Optional<String> newPath()
      The file name at the new git tree identified by newId()
    • oldId

      public abstract org.eclipse.jgit.lib.AbbreviatedObjectId oldId()
      The 20 bytes SHA-1 object ID of the old git tree of the diff, or ObjectId.zeroId() if newId() was a root git tree (i.e. has no parents).
    • newId

      public abstract org.eclipse.jgit.lib.AbbreviatedObjectId newId()
      The 20 bytes SHA-1 object ID of the new git tree of the diff.
    • oldMode

      public abstract Optional<Patch.FileMode> oldMode()
      The file mode of the old file at the old git tree diff identified by oldId().
    • newMode

      public abstract Optional<Patch.FileMode> newMode()
      The file mode of the new file at the new git tree diff identified by newId().
    • changeType

      public abstract Patch.ChangeType changeType()
      The change type associated with the file.
    • patchType

      public abstract Optional<Patch.PatchType> patchType()
      The patch type associated with the file.
    • negative

      public abstract Optional<Boolean> negative()
      Returns true if the diff computation was not able to compute a diff. We cache negative result in this case.
    • isEmpty

      public boolean isEmpty()
      Returns true if the object was created using the empty(AbbreviatedObjectId, AbbreviatedObjectId, String) method.
    • isNegative

      public boolean isNegative()
      Returns true if the diff computation was not able to compute a diff. We cache negative result in this case.
    • weight

      public int weight()
      Returns the size of the object in bytes.
    • getDefaultPath

      public String getDefaultPath()
    • builder

      public static GitFileDiff.Builder builder()
    • toBuilder

      public abstract GitFileDiff.Builder toBuilder()