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¶ Property-like class used to store/retrieve Base64 values.
This works much like a property, and takes care of encoding strings for storage and decoding them on retrieval. It’s set internally by
Base64Fieldin place of the normal field attribute.
-
-
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¶ Property-like class used to store/retrieve Base64 values.
This works much like a property, and takes care of encoding strings for storage and decoding them on retrieval. It’s set internally by
Base64Fieldin place of the normal field attribute.
-
parent_diff64¶ Property-like class used to store/retrieve Base64 values.
This works much like a property, and takes care of encoding strings for storage and decoding them on retrieval. It’s set internally by
Base64Fieldin place of the normal field attribute.
-
source_file_display[source]¶ The displayed filename for the source/original file.
This may be different than
source_file, as the associatedSCMToolmay normalize it for display.- Type:
- unicode
-
dest_file_display[source]¶ The displayed filename for the destination/modified file.
This may be different than
dest_file, as the associatedSCMToolmay normalize it for display.- Type:
- unicode
-
is_parent_diff_empty(cache_only=False)[source]¶ Return whether or not the parent diff is empty.
Parameters: cache_only (bool, optional) – Whether or not to only use cached results. Returns: Whether or not the parent diff is empty. This is true if either there is no parent diff or if the parent diff has no insertions and no deletions. Return type: bool
-
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.
-