1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/src/applications/differential/parser
epriestley aa310230b6 Detect moves and copies with some unchanged lines as moves or copies
Summary:
Ref T1266. We won't detect a move/copy if fewer than 3 lines are changed.

However, you may move a block like:

  Complicated Line A
  Trivial Line B
  Complicated Line C

...where "Trivial Line B" is something like a curly brace. If you move this block somewhere that happened to previously have a similar trivial curly brace line, we won't be able to find 3 contiguous added lines in order to detect the copy/move.

Instead, consider both changed and unchanged lines when trying to find contiguous blocks. This allows us to detect across gaps where lines were not actually changed.

This new algorithm may be too liberal (for example, we may end up incorrectly identifying moved/copied code before or after changed lines, not just between changed lines), but we can keep an eye on it and tweak it. The algorithm is better factored and better covered, now.

Test Plan:
  - Added a unit test for this case.
  - Spot-checked a handful of diffs and generally saw behavior that made sense and looked better than before.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1266

Differential Revision: https://secure.phabricator.com/D12146
2015-03-24 13:12:24 -07:00
..
__tests__ Rename DifferentialHunk subclasses for consistency 2015-01-23 07:17:04 +11:00
DifferentialChangesetParser.php Detect moves and copies with some unchanged lines as moves or copies 2015-03-24 13:12:24 -07:00
DifferentialCommitMessageParser.php Fix string truncation calls all over the codebase. 2015-01-05 11:14:54 -08:00
DifferentialCustomFieldDependsOnParser.php Clean up various pieces of dead/obsolete Differential code 2014-03-11 13:02:19 -07:00
DifferentialCustomFieldRevertsParser.php Clean up various pieces of dead/obsolete Differential code 2014-03-11 13:02:19 -07:00
DifferentialHunkParser.php Expand Differential test coverage to include moves, shields, and more 2015-03-05 14:00:26 -08:00