Homec4science

Simplify hunk parsing

Authored by epriestley <git@epriestley.com> on Jan 12 2013, 00:25.

Description

Simplify hunk parsing

Summary:
Simplify whitespace-ignoring diffing:

  • Currently, we generate two diffs (one ignoring whitespace, one normal) and then copy the text content from the normal one to the whitespace-ignoring one.
  • Instead, copy the change types from the ignoring one to the normal one.
    • This is cheaper and much simpler.
    • It means that we have the right change types in reparseHunksForSpecialAttributes(), and can simplify some other things.

Simplify whitespace changes, unchanged files, and deleted file detections:

  • Currently, we do this inline with a bunch of other stuff, in the reparse step.
  • Instead, do it separately. This is simpler.

Simplify intraline whitespace handling:

  • Currently, this is a complicated mess that makes roughly zero sense.
  • Instead, do it in reparse in a straightforward way.

Partially fix handling of files changed only by changing whitespace.
Partially fix handling of unchanged files.

Test Plan:

  • Ran unit tests.
  • Created context-less diffs, verified they rendered reasonably.
  • Generated a diff with prefix whitespace, suffix whitespace, intraline whitespace, and non-whitespace changes. Verified changes rendered correctly in "ignore most" and "show all" modes.
  • Verified unchanged files and files with only whitspace changes render with the correct masks.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D4398

Details

Committed
epriestley <git@epriestley.com>Jan 12 2013, 00:25
Pushed
aubortJan 31 2017, 17:16
Parents
rPHdbeb60adbe92: Display other locations of lint errors
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH039a5a6d8618: Simplify hunk parsing (authored by epriestley <git@epriestley.com>).Jan 12 2013, 00:25