FileComparison

sealed trait FileComparison

A file comparison that contains information on the changes to a file. There are two subtypes: FileComparisonNotRenamed and FileComparisonRenamed that have different guarantees.

  • FileComparisonNotRenamed guarantees that the patch field exists, does not have a previous_filename field.
  • FileComparisonRenamed guarantees that the previous_filename field exists and sometimes contains a patch field.

To get values from these fields, there are helper methods getPatch and getPreviousFilename, though it is recomended to match on your FileComparison value to determine which type it is, to remove ambiguity.

Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def additions: Int
def blob_url: String
def changes: Int
def contents_url: String
def deletions: Int
def filename: String
def getPatch: Option[String]

Gets the contents of the patch field if it exists, in the case that the file was modified. To guarantee that the patch field is available, match this FileComparison value as a FileComparison.FileComparisonNotRenamed type which always has this field.

Gets the contents of the patch field if it exists, in the case that the file was modified. To guarantee that the patch field is available, match this FileComparison value as a FileComparison.FileComparisonNotRenamed type which always has this field.

def getPreviousFilename: Option[String]

Gets the contents of the previous_filename field if it exists. This field is guaranteed to appear in the event of any rename. To guarantee that this field is available, match this FileComparison value as a FileComparison.FileComparisonRenamde type which always has this field.

Gets the contents of the previous_filename field if it exists. This field is guaranteed to appear in the event of any rename. To guarantee that this field is available, match this FileComparison value as a FileComparison.FileComparisonRenamde type which always has this field.

def raw_url: String
def sha: String
def status: String