reviewboard.diffviewer.models.diffset¶
DiffSet model definition.
- class DiffSet(*args, **kwargs)[source]¶
Bases:
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 aForwardManyToOneDescriptor
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 aForwardManyToOneDescriptor
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.
- property 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 theextra_data
field will be updated.If
False
, the caller must save this model.
- Returns:
The list of created FileDiffs.
- Return type:
- Raises:
django.core.exceptions.ValidationError – The commit series failed validation.
- property 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.
- property 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]¶
Return a human-readable representation of the DiffSet.
- Returns:
A human-readable representation of the DiffSet.
- Return type:
- __annotations__ = {}¶
- commits¶
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 aReverseManyToOneDescriptor
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)¶
- 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 aReverseManyToOneDescriptor
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_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=True, **kwargs)¶
- get_previous_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=False, **kwargs)¶
- history_id¶
- id¶
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)¶
- reinit_commit_count()¶
- reload_commit_count()¶
- repository_id¶
- review_request_draft¶
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 aReverseManyToOneDescriptor
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¶
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 aReverseManyToOneDescriptor
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)¶