reviewboard.diffviewer.models¶
- 
class 
LegacyFileDiffData(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelDeprecated, legacy class for base64-encoded diff data.
This is no longer populated, and exists solely to store legacy data that has not been migrated to
RawFileDiffData.- 
binary¶ 
- 
 
- 
class 
RawFileDiffData(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelStores raw diff data as binary content in the database.
This is the class used in Review Board 2.5+ to store diff content. Unlike in previous versions, the content is not base64-encoded. Instead, it is stored either as bzip2-compressed data (if the resulting compressed data is smaller than the raw data), or as the raw data itself.
- 
content[source]¶ Returns the content of the diff.
The content will be uncompressed (if necessary) and returned as the raw set of bytes originally uploaded.
- 
 
- 
class 
FileDiff(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA diff of a single file.
This contains the patch and information needed to produce original and patched versions of a single file in a repository.
- 
STATUSES= ((u’C’, _(u’Copied’)), (u’D’, _(u’Deleted’)), (u’M’, _(u’Modified’)), (u’V’, _(u’Moved’)))[source]¶ 
- 
diff64¶ 
- 
parent_diff64¶ 
- 
get_line_counts()[source]¶ Returns the stored line counts for the diff.
This will return all the types of line counts that can be set:
raw_insert_countraw_delete_countinsert_countdelete_countreplace_countequal_counttotal_line_count
These are not all guaranteed to have values set, and may instead be None. Only
raw_insert_count,raw_delete_countinsert_count, anddelete_countare guaranteed to have values set.If there isn’t a processed number of inserts or deletes stored, then
insert_countanddelete_countwill be equal to the raw versions.
- 
set_line_counts(raw_insert_count=None, raw_delete_count=None, insert_count=None, delete_count=None, replace_count=None, equal_count=None, total_line_count=None)[source]¶ Sets the line counts on the FileDiff.
There are many types of useful line counts that can be set.
raw_insert_countandraw_delete_countcorrespond to the raw inserts and deletes in the actual patch, which will be set both in this FileDiff and in the associated RawFileDiffData.The other counts are stored exclusively in FileDiff, as they are more render-specific.
- 
 
- 
class 
DiffSet(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA revisioned collection of FileDiffs.
- 
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.DiffSetHistory) – The diffset history used to compute the new revision. Raises: ValueError– The revision already has a valid value set, and cannot be updated.
-