Changeset View
Changeset View
Standalone View
Standalone View
src/parser/ArcanistBundle.php
| Show First 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | while ($ii < $n) { | ||||
| // We haven't seen a change in $context lines, so this is a | // We haven't seen a change in $context lines, so this is a | ||||
| // potential place to break the hunk. However, we need to keep | // potential place to break the hunk. However, we need to keep | ||||
| // looking in case there is another change fewer than $context | // looking in case there is another change fewer than $context | ||||
| // lines away, in which case we have to merge the hunks. | // lines away, in which case we have to merge the hunks. | ||||
| $break_here = $jj; | $break_here = $jj; | ||||
| } | } | ||||
| } | } | ||||
| if ($jj - $last_change > (($context + 1) * 2)) { | // If the context value is "3" and there are 7 unchanged lines | ||||
| // between the two changes, we could either generate one or two hunks | |||||
| // and end up with the same number of output lines. If we generate | |||||
| // one hunk, the middle line will be a line of source. If we generate | |||||
| // two hunks, the middle line will be an "@@ -1,2 +3,4 @@" header. | |||||
| // We choose to generate two hunks because this is the behavior of | |||||
| // "diff -u". See PHI838. | |||||
| if ($jj - $last_change >= ($context * 2 + 1)) { | |||||
| // We definitely aren't going to merge this with the next hunk, so | // We definitely aren't going to merge this with the next hunk, so | ||||
| // break out of the loop. We'll end the hunk at $break_here. | // break out of the loop. We'll end the hunk at $break_here. | ||||
| break; | break; | ||||
| } | } | ||||
| } else { | } else { | ||||
| $break_here = null; | $break_here = null; | ||||
| $last_change = $jj; | $last_change = $jj; | ||||
| ▲ Show 20 Lines • Show All 483 Lines • Show Last 20 Lines | |||||