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 4 and 5

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.
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
Update patience differ test cases and added patience diff as one new differ o...
3a8a96d0518478d597cc1d1b76fb6252fa4fa4ba Bruce Nie
Removed unecessary tabs and spaces in files
36b33edda96fe5a6e6ff6851dd0fe4c760b71407 Bruce Nie
Updated PatienceDiffer tests and added new functions to pre-process code blocks
before generating opcodes
b009817dbb7bd7e9b36438eb48adfb9cb2eb8a4f Bruce Nie
Check in final version with all bug fixed. Need to polish comments.
Signed-off-by: Bruce Nie <ynie@ualberta.ca>
877e67a8673197202c367e02a5855b0e587f5906 Bruce Nie
reviewboard/diffviewer/patiencediff.py
reviewboard/diffviewer/tests/test_patiencediff.py
Loading...