Diff processing and filtering logic.
- CHUNK_RANGE_RE = re.compile(b'^@@ -(?P<orig_start>\\d+)(,(?P<orig_len>\\d+))? \\+(?P<new_start>\\d+)(,(?P<new_len>\\d+))? @@', re.MULTILINE)¶
Regex for matching a diff chunk line.
Deprecated since version 3.0.18: This has been replaced with
reviewboard.diffviewer.diffutils.CHUNK_RANGE_RE. Its group names differ from this version.
- filter_interdiff_opcodes(opcodes, filediff_data, interfilediff_data, request=None)¶
Filter the opcodes for an interdiff to remove unnecessary lines.
An interdiff may contain lines of code that have changed as the result of updates to the tree between the time that the first and second diff were created. This leads to some annoyances when reviewing.
This function will filter the opcodes to remove as much of this as possible. It will only output non-“equal” opcodes if it falls into the ranges of lines dictated in the uploaded diff files.
Changed in version 3.0.18: Added the
requestargument, and added support for the version 2 algorithm from Review Board 4.0 (through the
tuple– An opcode to render for the diff.
Post-processes filtered-equal and equal chunks from interdiffs.
Any filtered-out “filtered-equal” chunks will get turned back into “equal” chunks and merged into any prior equal chunks. Likewise, simple “equal” chunks will also get merged.
“equal” chunks that have any indentation information will remain their own chunks, with nothing merged in.