Page MenuHomePhabricator

Make prose diff algorithm more iterative, to improve prose diffs for (among other things) removed commas
ClosedPublic

Authored by epriestley on Nov 10 2016, 8:35 PM.
Tags
None
Referenced Files
F12824876: D16839.id40551.diff
Thu, Mar 28, 8:38 AM
F12815923: D16839.diff
Thu, Mar 28, 3:18 AM
F12809755: D16839.id40552.diff
Wed, Mar 27, 9:45 PM
F12805388: D16839.id40550.diff
Wed, Mar 27, 5:15 PM
F12805386: D16839.id.diff
Wed, Mar 27, 5:15 PM
Unknown Object (File)
Tue, Mar 26, 3:44 PM
Unknown Object (File)
Sat, Mar 23, 5:24 PM
Unknown Object (File)
Feb 10 2024, 12:34 AM
Subscribers
None

Details

Summary

Ref T7643. This is a little hard to explain but before we would do this:

  • Diff paragraphs.
  • For each different paragraph, diff sentences
  • For each different sentence, diff characters.

Now, we do this:

  • Diff paragraphs.
  • Collect all the identical, purely added, and purely removed paragraphs and set them aside. We know we should have good diffs for these already.
  • What's left over is sequences of removed/added/changed paragraphs, which we may not have great diffs for yet. Smush these together into big diff blocks.
  • Now, for these blocks, diff sentences.
  • Repeat all of that to diff characters.

This seems to pass all the existing unit tests, and pass new unit tests which I was previously unable to make pass by fiddling with things without changing the algorithm.

Test Plan

Passed existing unit tests. Passed new unit tests.

Diff Detail

Repository
rPHU libphutil
Branch
prose1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 14442
Build 18822: Run Core Tests
Build 18821: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Make prose diff algorithm more iterative, to improve prose diffs for (among other things) removed commas.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.

I bet all the new select UI looks great in Safari!

This revision is now accepted and ready to land.Nov 10 2016, 8:37 PM
epriestley edited edge metadata.
  • Smaller diff.

Seems fine to me? Maybe my special monitor calibration is hiding the badness?

(I made them all look like Chrome)

This revision was automatically updated to reflect the committed changes.