Add Patience Differ to diff viewer.

Review Request #11239 — Created Oct. 22, 2020 and updated — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

Review Board uses a version of the Meyers Diff algorithm for the diff viewer,
which is pretty standard and widely-used. However, unclear diff might be
reported under some scenarios. For example, when user switched order of a big
chunk of code with each other, meyer diff will see it as a change line by line
instead of being aware that the whole block is switched. Patience differ
tackles issues like these by scanning the whole file and actively seeking out
interesting lines before applying diff while sacrificing some performances.

This is a backend feature and it has not been updated to be the default method
of diffing. To test this feature, you could go to
reviewboard/diffviewer/differ.py, and update line 26 to DEFAULT = PATIENCE.

Unit tests are created in reviewboard/diffviewer/tests/test_patiencediff.py.
You can run the test by
./tests/runtests.py reviewboard.diffviewer.tests.test_patiencediff:PatienceDifferTest.
All unit tests have passed.

Diff Revision 8

This is not the most recent revision of the diff. The latest diff is revision 10. See what's changed.

orig
1
2
3
4
5
6
7
8
9
10

Commits

First Last Summary ID Author
Added two more parameter to indicate start index of a and b file, and modified
unit tests accordingly.
14cfcd3b1e28ef1093b7248d898df9b25d94845f Bruce Nie
Added patience differ as a new option in differ class.
962bbe21c1466137f81987e6e41723ecf3ffdd63 Bruce Nie
Added patience diff unit tests.
c049933abe62a1cd1b7246fc3a4c20f43bb742a1 Bruce Nie
Added PatienceDiffer to Diff Viewer.
afb55222047babced031559e8afc462c39be6c20 Bruce Nie
Fixed issues flagged by flake8
3b4f77a94a6d97245c18d0732dd94829ee6c37a0 Bruce Nie
reviewboard/diffviewer/differ.py
reviewboard/diffviewer/myersdiff.py
reviewboard/diffviewer/patiencediff.py
reviewboard/diffviewer/tests/test_myersdiff.py
reviewboard/diffviewer/tests/test_patiencediff.py
Loading...