HomePhabricator

Make the ArcanistBundle algorithm do what "diff -u" does when hunks are…

Description

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

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.

Reviewers: amckinley

Maniphest Tasks: T13187

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