1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 03:42:41 +01:00
phorge-phorge/src/applications/differential/storage
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__ Detect moves and copies with some unchanged lines as moves or copies 2015-03-24 13:12:24 -07:00
DifferentialAffectedPath.php Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
DifferentialChangeset.php Rename DifferentialHunk subclasses for consistency 2015-01-23 07:17:04 +11:00
DifferentialCustomFieldNumericIndex.php Various linter fixes. 2014-02-26 12:44:58 -08:00
DifferentialCustomFieldStorage.php Various linter fixes. 2014-02-26 12:44:58 -08:00
DifferentialCustomFieldStringIndex.php Various linter fixes. 2014-02-26 12:44:58 -08:00
DifferentialDAO.php Delete license headers from files 2012-11-05 11:16:51 -08:00
DifferentialDiff.php Rename DifferentialHunk subclasses for consistency 2015-01-23 07:17:04 +11:00
DifferentialDiffProperty.php Fix almost all remaining schemata issues 2014-10-01 08:18:36 -07:00
DifferentialDiffTransaction.php Differential - make DifferentialDiffEditor into a real transaction editor. 2014-11-18 15:32:23 -08:00
DifferentialDraft.php Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
DifferentialHunk.php Provide better parsing primitives for hunks 2015-03-24 13:11:37 -07:00
DifferentialInlineComment.php Track a "Done" state on inline comments 2015-03-24 05:26:11 -07:00
DifferentialLegacyHunk.php Rename DifferentialHunk subclasses for consistency 2015-01-23 07:17:04 +11:00
DifferentialModernHunk.php Rename DifferentialHunk subclasses for consistency 2015-01-23 07:17:04 +11:00
DifferentialReviewer.php Rename PHIDType classes 2014-07-24 08:05:46 +10:00
DifferentialRevision.php Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
DifferentialSchemaSpec.php Automatically build all Lisk schemata 2014-10-02 09:51:20 -07:00
DifferentialTransaction.php Lift inline comment state transactions into core (in Differential) 2015-03-24 05:26:16 -07:00
DifferentialTransactionComment.php Write "hasReplies" to database for inline comments 2015-03-09 14:11:16 -07:00