Changeset View
Changeset View
Standalone View
Standalone View
src/difference/ArcanistDiffUtils.php
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | final class ArcanistDiffUtils extends Phobject { | ||||
public static function generateEditString(array $ov, array $nv, $max = 80) { | public static function generateEditString(array $ov, array $nv, $max = 80) { | ||||
return id(new PhutilEditDistanceMatrix()) | return id(new PhutilEditDistanceMatrix()) | ||||
->setComputeString(true) | ->setComputeString(true) | ||||
->setAlterCost(1 / ($max * 2)) | ->setAlterCost(1 / ($max * 2)) | ||||
->setReplaceCost(2) | ->setReplaceCost(2) | ||||
->setMaximumLength($max) | ->setMaximumLength($max) | ||||
->setSequences($ov, $nv) | ->setSequences($ov, $nv) | ||||
->setApplySmoothing(true) | ->setApplySmoothing(PhutilEditDistanceMatrix::SMOOTHING_INTERNAL) | ||||
->getEditString(); | ->getEditString(); | ||||
} | } | ||||
public static function computeIntralineEdits($o, $n) { | public static function computeIntralineEdits($o, $n) { | ||||
if (preg_match('/[\x80-\xFF]/', $o.$n)) { | if (preg_match('/[\x80-\xFF]/', $o.$n)) { | ||||
$ov = phutil_utf8v_combined($o); | $ov = phutil_utf8v_combined($o); | ||||
$nv = phutil_utf8v_combined($n); | $nv = phutil_utf8v_combined($n); | ||||
$multibyte = true; | $multibyte = true; | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |