Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15292382
D16069.id38661.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D16069.id38661.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 6, 2:12 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223156
Default Alt Text
D16069.id38661.diff (1 KB)
Attached To
Mode
D16069: Use EditDistanceMatrix diff smoothing in Arcanist
Attached
Detach File
Event Timeline
Log In to Comment