Jump to >

reviewboard.diffviewer.models.diffcommit

DiffCommit model definition.

class DiffCommit(*args, **kwargs)[source]

A representation of a commit from a version control system.

A DiffSet on a Review Request that represents a commit history will have one or more DiffCommits. Each DiffCommit will have one or more associated FileDiffs (which also belong to the parent DiffSet).

The information stored herein is intended to fully represent the state of a single commit in that history. The series of DiffCommits can be used to re-create the original series of commits posted for review.

NAME_MAX_LENGTH = 256[source]

The maximum length of the author_name and committer_name fields.

EMAIL_MAX_LENGTH = 256[source]

The maximum length of the author_email and committer_email fields.

ISO_DATE_FORMAT = '%Y-%m-%d %H:%M:%S%z'[source]

The date format that this model uses.

last_modified[source]

A timestamp used for generating HTTP caching headers.

property author[source]

The author’s name and e-mail address.

This is formatted as author_name <author_email>.

property author_date[source]

The author date in its original timezone.

property committer[source]

The committer’s name and e-mail address (if applicable).

This will be formatted as committer_name <committer_email> if both committer_name and committer_email are set. Otherwise, it be whichever is defined. If neither are defined, this will be None.

property committer_date[source]

The committer date in its original timezone.

If the commit has no committer, this will be None.

summary[source]

The first line of the commit message.

summary_truncated[source]

The first line of the commit message, truncated to 80 characters.

serialize()[source]

Serialize to a dictionary.

Returns

A dictionary representing this commit.

Return type

dict

get_total_line_counts()[source]

Return the total line counts of all child FileDiffs.

Returns

A dictionary with the following keys:

  • raw_insert_count

  • raw_delete_count

  • insert_count

  • delete_count

  • replace_count

  • equal_count

  • total_line_count

Each entry maps to the sum of that line count type for all child FileDiffs.

Return type

dict