Jump to >

reviewboard.diffviewer.models.diffset

DiffSet model definiton.

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

Bases: django.db.models.base.Model

A revisioned collection of FileDiffs.

name[source]

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

revision[source]

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

timestamp[source]

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

basedir[source]

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

history[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.

repository[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.

diffcompat[source]

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

base_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.

commit_count = <djblets.db.fields.relation_counter_field.RelationCounterField: commit_count>[source]
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.DiffSetManager object>[source]
is_commit_series_finalized[source]

Whether the commit series represented by this DiffSet is finalized.

When a commit series is finalized, no more DiffCommits can be added to it.

finalize_commit_series(cumulative_diff, validation_info, parent_diff=None, request=None, validate=True, save=False)[source]

Finalize the commit series represented by this DiffSet.

Parameters:
  • cumulative_diff (bytes) – The cumulative diff of the entire commit series.
  • validation_info (dict) – The parsed validation information.
  • parent_diff (bytes, optional) – The parent diff of the cumulative diff, if any.
  • request (django.http.HttpRequest, optional) – The HTTP request from the client, if any.
  • validate (bool, optional) – Whether or not the cumulative diff (and optional parent diff) should be validated, up to and including file existence checks.
  • save (bool, optional) –

    Whether to save the model after finalization. Defaults to False.

    If True, only the extra_data field will be updated.

    If False, the caller must save this model.

Returns:

The list of created FileDiffs.

Return type:

list of reviewboard.diffviewer.models.filediff.FileDiff

Raises:

django.core.exceptions.ValidationError – The commit series failed validation.

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
per_commit_files[source]

The files limited to per-commit diffs.

This will cache the results for future lookups. If the set of all files has already been fetched with prefetch_related(), no queries will be performed.

cumulative_files[source]

The files limited to the cumulative diff.

This will cache the results for future lookups. If the set of all files has been already been fetched with prefetch_related(), no queries will be incurred.

update_revision_from_history(diffset_history)[source]

Update the revision of this diffset based on a diffset history.

This will determine the appropriate revision to use for the diffset, based on how many other diffsets there are in the history. If there aren’t any, the revision will be set to 1.

Parameters:diffset_history (reviewboard.diffviewer.models.diffset_history.DiffSetHistory) – The diffset history used to compute the new revision.
Raises:ValueError – The revision already has a valid value set, and cannot be updated.
save(**kwargs)[source]

Save this diffset.

This will set an initial revision of 1 if this is the first diffset in the history, and will set it to on more than the most recent diffset otherwise.

Parameters:**kwargs (dict) – Extra arguments for the save call.
__str__()[source]
__unicode__()[source]

Return a human-readable representation of the DiffSet.

Returns:A human-readable representation of the DiffSet.
Return type:unicode
commits[source]

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.

decrement_commit_count(*args, **kwargs)[source]
files[source]

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()[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
history_id[source]

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

id[source]

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

increment_commit_count(*args, **kwargs)[source]
reinit_commit_count()[source]
reload_commit_count()[source]
repository_id[source]

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

review_request_draft[source]

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.

review_set[source]

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.

set_extra_data_json(json)[source]