Page MenuHomePhabricator

D16069.id38665.diff
No OneTemporary

D16069.id38665.diff

diff --git a/src/difference/ArcanistDiffUtils.php b/src/difference/ArcanistDiffUtils.php
--- a/src/difference/ArcanistDiffUtils.php
+++ b/src/difference/ArcanistDiffUtils.php
@@ -151,6 +151,7 @@
->setReplaceCost(2)
->setMaximumLength($max)
->setSequences($ov, $nv)
+ ->setApplySmoothing(true)
->getEditString();
}
@@ -167,25 +168,6 @@
$result = self::generateEditString($ov, $nv);
- // Smooth the string out, by replacing short runs of similar characters
- // with 'x' operations. This makes the result more readable to humans, since
- // there are fewer choppy runs of short added and removed substrings.
- do {
- $original = $result;
- $result = preg_replace(
- '/([xdi])(s{3})([xdi])/',
- '$1xxx$3',
- $result);
- $result = preg_replace(
- '/([xdi])(s{2})([xdi])/',
- '$1xx$3',
- $result);
- $result = preg_replace(
- '/([xdi])(s{1})([xdi])/',
- '$1x$3',
- $result);
- } while ($result != $original);
-
// Now we have a character-based description of the edit. We need to
// convert into a byte-based description. Walk through the edit string and
// adjust each operation to reflect the number of bytes in the underlying
diff --git a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php
--- a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php
+++ b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php
@@ -60,12 +60,12 @@
array(
'abcdefg',
'abxdxfg',
- 'ssxsxss',
+ 'ssxxxss',
),
array(
'private function a($a, $b) {',
'public function and($b, $c) {',
- 'siixsdddxsssssssssssiissxsssxsss',
+ 'siixxdddxsssssssssssiixxxxxxxsss',
),
array(

File Metadata

Mime Type
text/plain
Expires
Wed, May 8, 10:28 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6273322
Default Alt Text
D16069.id38665.diff (1 KB)

Event Timeline