Page MenuHomePhabricator

Make the ArcanistBundle algorithm do what "diff -u" does when hunks are arguably mergeable
ClosedPublic

Authored by epriestley on Aug 24 2018, 5:58 PM.
Tags
None
Referenced Files
F15500959: D19603.id46867.diff
Sun, Apr 13, 8:01 PM
F15467719: D19603.id46865.diff
Thu, Apr 3, 5:33 PM
F15466695: D19603.id46865.diff
Thu, Apr 3, 8:32 AM
F15465499: D19603.id.diff
Wed, Apr 2, 7:36 PM
F15465289: D19603.id46865.diff
Wed, Apr 2, 4:53 PM
F15462705: D19603.diff
Tue, Apr 1, 5:02 PM
F15450972: D19603.id46865.diff
Fri, Mar 28, 7:22 PM
F15427473: D19603.id46865.diff
Sun, Mar 23, 2:35 PM
Subscribers
None

Details

Summary

Ref T13187. See PHI838. If two hunks are separated by 7 lines of context, we can render them as either:

+ Hunk A
  Context 1
  Context 2
  Context 3
  Context 4
  Context 5
  Context 6
  Context 7
+ Hunk B

...or:

+ Hunk A
  Context 1
  Context 2
  Context 3
@@ +1,2 -3,4 @@
  Context 5
  Context 6
  Context 7
+ Hunk B

Since we get the same number of output lines either way and the first one is more human-readable, we picked that one.

However, diff -u does the second one. Since human-readability is probably less important than compatibility, change the behavior to be more similar to diff -u.

Test Plan

Added unit tests for the edge cases with default parameters (6 context lines, 7 context lines) and made them pass.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.Aug 24 2018, 5:58 PM
epriestley requested review of this revision.
This revision was automatically updated to reflect the committed changes.