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
F13980448: D16839.id.diff
Sat, Oct 19, 10:47 AM
F13970401: D16839.id40550.diff
Thu, Oct 17, 7:29 AM
F13969137: D16839.id40552.diff
Thu, Oct 17, 12:41 AM
F13961896: D16839.id40550.diff
Tue, Oct 15, 6:54 AM
F13957701: D16839.id40551.diff
Mon, Oct 14, 10:48 AM
F13957633: D16839.diff
Mon, Oct 14, 10:26 AM
Unknown Object (File)
Oct 1 2024, 6:06 PM
Unknown Object (File)
Sep 26 2024, 7:56 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.