diff --git a/scripts/arcanist.php b/scripts/arcanist.php index c888fae9..dc2f07b7 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -284,7 +284,9 @@ try { $blind_key = 'https.blindly-trust-domains'; $blind_trust = $configuration_manager->getConfigFromAnySource($blind_key); if ($blind_trust) { - HTTPSFuture::setBlindlyTrustDomains($blind_trust); + $trust_extension = PhutilHTTPEngineExtension::requireExtension( + ArcanistBlindlyTrustHTTPEngineExtension::EXTENSIONKEY); + $trust_extension->setDomains($blind_trust); } if ($need_conduit) { diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 6012daf7..cd419223 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -36,6 +36,7 @@ phutil_register_library_map(array( 'ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase.php', 'ArcanistBlacklistedFunctionXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBlacklistedFunctionXHPASTLinterRule.php', 'ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase.php', + 'ArcanistBlindlyTrustHTTPEngineExtension' => 'configuration/ArcanistBlindlyTrustHTTPEngineExtension.php', 'ArcanistBookmarkWorkflow' => 'workflow/ArcanistBookmarkWorkflow.php', 'ArcanistBraceFormattingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php', 'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBraceFormattingXHPASTLinterRuleTestCase.php', @@ -450,6 +451,7 @@ phutil_register_library_map(array( 'ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistBlacklistedFunctionXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', + 'ArcanistBlindlyTrustHTTPEngineExtension' => 'PhutilHTTPEngineExtension', 'ArcanistBookmarkWorkflow' => 'ArcanistFeatureWorkflow', 'ArcanistBraceFormattingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', diff --git a/src/configuration/ArcanistBlindlyTrustHTTPEngineExtension.php b/src/configuration/ArcanistBlindlyTrustHTTPEngineExtension.php new file mode 100644 index 00000000..098d04a2 --- /dev/null +++ b/src/configuration/ArcanistBlindlyTrustHTTPEngineExtension.php @@ -0,0 +1,27 @@ +domains[phutil_utf8_strtolower($domain)] = true; + } + return $this; + } + + public function getExtensionName() { + return pht('Arcanist HTTPS Trusted Domains'); + } + + public function shouldTrustAnySSLAuthorityForURI(PhutilURI $uri) { + $domain = $uri->getDomain(); + $domain = phutil_utf8_strtolower($domain); + return isset($this->domains[$domain]); + } + +} diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php index 3473a0bd..0d0a92e7 100644 --- a/src/configuration/ArcanistConfigurationManager.php +++ b/src/configuration/ArcanistConfigurationManager.php @@ -100,7 +100,17 @@ final class ArcanistConfigurationManager extends Phobject { } $user_config = $this->readUserArcConfig(); - $pval = idx($user_config, $key); + + // For "aliases" coming from the user config file specifically, read the + // top level "aliases" key instead of the "aliases" key inside the "config" + // setting. Aliases were originally user-specific but later became standard + // configuration, which is why this works oddly. + if ($key === 'aliases') { + $pval = idx($this->readUserConfigurationFile(), $key); + } else { + $pval = idx($user_config, $key); + } + if ($pval !== null) { $results[self::CONFIG_SOURCE_USER] = $settings->willReadValue($key, $pval); diff --git a/src/difference/ArcanistDiffUtils.php b/src/difference/ArcanistDiffUtils.php index dab50e0c..111f9d02 100644 --- a/src/difference/ArcanistDiffUtils.php +++ b/src/difference/ArcanistDiffUtils.php @@ -151,6 +151,7 @@ final class ArcanistDiffUtils extends Phobject { ->setReplaceCost(2) ->setMaximumLength($max) ->setSequences($ov, $nv) + ->setApplySmoothing(PhutilEditDistanceMatrix::SMOOTHING_INTERNAL) ->getEditString(); } @@ -167,25 +168,6 @@ final class ArcanistDiffUtils extends Phobject { $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 index 26fa9e47..cce90c6f 100644 --- a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php +++ b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php @@ -60,12 +60,12 @@ final class ArcanistDiffUtilsTestCase extends PhutilTestCase { array( 'abcdefg', 'abxdxfg', - 'ssxsxss', + 'ssxxxss', ), array( 'private function a($a, $b) {', 'public function and($b, $c) {', - 'siixsdddxsssssssssssiissxsssxsss', + 'siixxdddxsssssssssssiixxxxxxxsss', ), array( diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php index 169f66ea..887fa4f3 100644 --- a/src/repository/api/ArcanistSubversionAPI.php +++ b/src/repository/api/ArcanistSubversionAPI.php @@ -451,6 +451,10 @@ EODIFF; } protected function buildSyntheticAdditionDiff($path, $source, $rev) { + if (is_dir($this->getPath($path))) { + return null; + } + $type = $this->getSVNProperty($path, 'svn:mime-type'); if ($type == 'application/octet-stream') { return <<getPath($path))) { - return null; - } - $data = Filesystem::readFile($this->getPath($path)); list($orig) = execx('svn cat %s@%s', $source, $rev); diff --git a/src/workflow/ArcanistAliasWorkflow.php b/src/workflow/ArcanistAliasWorkflow.php index 7fc9dfe7..b27b3ebf 100644 --- a/src/workflow/ArcanistAliasWorkflow.php +++ b/src/workflow/ArcanistAliasWorkflow.php @@ -59,17 +59,14 @@ EOTEXT public static function getAliases( ArcanistConfigurationManager $configuration_manager) { + $sources = $configuration_manager->getConfigFromAllSources('aliases'); - $working_copy_config_aliases = - $configuration_manager->getProjectConfig('aliases'); - if (!$working_copy_config_aliases) { - $working_copy_config_aliases = array(); + $aliases = array(); + foreach ($sources as $source) { + $aliases += $source; } - $user_config_aliases = idx( - $configuration_manager->readUserConfigurationFile(), - 'aliases', - array()); - return $user_config_aliases + $working_copy_config_aliases; + + return $aliases; } private function writeAliases(array $aliases) { diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index 40a179f1..3a631e88 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -2591,10 +2591,6 @@ EOTEXT foreach ($need_upload as $key => $spec) { $change = $need_upload[$key]['change']; - $type = $spec['type']; - $size = strlen($spec['data']); - - $change->setMetadata("{$type}:file:size", $size); if ($spec['data'] === null) { // This covers the case where a file was added or removed; we don't // need to upload the other half of it (e.g., the old file data for @@ -2604,6 +2600,11 @@ EOTEXT continue; } + $type = $spec['type']; + $size = strlen($spec['data']); + + $change->setMetadata("{$type}:file:size", $size); + $mime = $this->getFileMimeType($spec['data']); if (preg_match('@^image/@', $mime)) { $change->setFileType($type_image);