Interface DiffHunk


public interface DiffHunk
Describes a single hunk, with one or more segments, in a diff.
  • Method Details

    • getContext

      @Nonnull default Optional<String> getContext()
      Retrieves the context snippet for the hunk, which may be empty() depending on the SCM's ability to detect it.

      Context is chosen by the SCM, and is based on the SCM's understanding of the syntax of the file. Depending on the syntax used, the SCM may not be able to detect the context or it may detect "incorrect" context.

      Returns:
      a context snippet for the hunk, which may be empty() if the SCM could not detect any
      Since:
      5.5
    • getDestinationLine

      int getDestinationLine()
      Returns:
      the starting line for this hunk in the destination file
    • getDestinationSpan

      int getDestinationSpan()
      Returns:
      the number of lines this hunk spans in the destination file
    • getSegments

      @Nonnull List<DiffSegment> getSegments()
      Returns:
      the segments included in this hunk
    • getSourceLine

      int getSourceLine()
      Returns:
      the starting line for this hunk in the source file
    • getSourceSpan

      int getSourceSpan()
      Returns:
      the number of lines this hunk spans in the source file
    • isTruncated

      boolean isTruncated()
      Returns:
      true if one or more entire segments were omitted due to the size of the hunk, or if any lines were omitted from an included segment; otherwise, false if all of the segments and lines in the hunk are included