public interface

DiffHunk

com.atlassian.bitbucket.content.DiffHunk

Class Overview

Describes a single hunk, with one or more segments, in a diff.

Summary

Public Methods
@Nonnull Optional<String> getContext()
Retrieves the context snippet for the hunk, which may be empty() depending on the SCM's ability to detect it.
int getDestinationLine()
int getDestinationSpan()
@Nonnull List<DiffSegment> getSegments()
int getSourceLine()
int getSourceSpan()
boolean isTruncated()

Public Methods

@Nonnull public 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

public int getDestinationLine ()

Returns
  • the starting line for this hunk in the destination file

public int getDestinationSpan ()

Returns
  • the number of lines this hunk spans in the destination file

@Nonnull public List<DiffSegment> getSegments ()

Returns
  • the segments included in this hunk

public int getSourceLine ()

Returns
  • the starting line for this hunk in the source file

public int getSourceSpan ()

Returns
  • the number of lines this hunk spans in the source file

public 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