reviewboard.diffviewer.models.diffset¶
DiffSet model definiton.
- class DiffSet(*args, **kwargs)[source]¶
A revisioned collection of FileDiffs.
- 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
list of reviewboard.diffviewer.models.filediff.FileDiff
- 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.