Jump to >


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.

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


The list of created FileDiffs.

Return type

list of reviewboard.diffviewer.models.filediff.FileDiff


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


Return the total line counts of all child FileDiffs.


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


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


diffset_history (reviewboard.diffviewer.models.diffset_history.DiffSetHistory) – The diffset history used to compute the new revision.


ValueError – The revision already has a valid value set, and cannot be updated.


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.


**kwargs (dict) – Extra arguments for the save call.