Jump to >

reviewboard.diffviewer.models.diffcommit

DiffCommit model definition.

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

Bases: django.db.models.base.Model

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.

filename[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

diffset[source]

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

author_name[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

author_email[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

author_date_utc[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

author_date_offset[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

committer_name[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

committer_email[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

committer_date_utc[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

committer_date_offset[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

commit_message[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

commit_id[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parent_id[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_modified[source]

A timestamp used for generating HTTP caching headers.

extra_data[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <reviewboard.diffviewer.managers.DiffCommitManager object>[source]
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

__str__()[source]

Return a human-readable representation of the commit.

Returns

The commit ID and its summary (if available).

Return type

unicode

__annotations__ = {}
diffset_id
files

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_extra_data_json()
get_next_by_author_date_utc(*, field=<django.db.models.fields.DateTimeField: author_date_utc>, is_next=True, **kwargs)
get_next_by_last_modified(*, field=<django.db.models.fields.DateTimeField: last_modified>, is_next=True, **kwargs)
get_previous_by_author_date_utc(*, field=<django.db.models.fields.DateTimeField: author_date_utc>, is_next=False, **kwargs)
get_previous_by_last_modified(*, field=<django.db.models.fields.DateTimeField: last_modified>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

set_extra_data_json(json)