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.

Changes between revision 1 and 2

orig
1
2
3
4
5
6
7
8
9
10

Commits

Summary ID Author
[WIP] Add Patience Differ to diff viewer.
c9e2112bea9ba3e65aa103cfb8f5737831c276a2 Bruce Nie
Check in work done so far that will not be part of Review Board:
Added patience diff folder with jupyter notebook and some sample files insidefor testing.
971b64d11610de99cc6b4ea4aa291dce93b19487 Bruce Nie
Check in work done so far that will not be part of Review Board:
Added patience diff folder with jupyter notebook and some sample files insidefor testing.
ffeb1e9454cd67c12c71a1ea9449d4d6e180c4b4 Bruce Nie
Added two more parameter to indicate start index of a and b file, and modified
unit tests accordingly.
eeab960675da6c2ae7eea8f6c84059cfbec09660 Bruce Nie
Updated patiencediff to call myers with no errors, added new test cases to ch...
dbef3c32f854dfedf8de19922edaf1b46f5435dc 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
reviewboard/notifications/webhooks.py
reviewboard/templates/forms/field.html
Loading...