1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 00:42:40 +01:00

(stable) Promote 2016 Week 23

This commit is contained in:
epriestley 2016-06-11 04:29:00 -07:00
commit 9c412dabf6
9 changed files with 61 additions and 40 deletions

View file

@ -284,7 +284,9 @@ try {
$blind_key = 'https.blindly-trust-domains'; $blind_key = 'https.blindly-trust-domains';
$blind_trust = $configuration_manager->getConfigFromAnySource($blind_key); $blind_trust = $configuration_manager->getConfigFromAnySource($blind_key);
if ($blind_trust) { if ($blind_trust) {
HTTPSFuture::setBlindlyTrustDomains($blind_trust); $trust_extension = PhutilHTTPEngineExtension::requireExtension(
ArcanistBlindlyTrustHTTPEngineExtension::EXTENSIONKEY);
$trust_extension->setDomains($blind_trust);
} }
if ($need_conduit) { if ($need_conduit) {

View file

@ -36,6 +36,7 @@ phutil_register_library_map(array(
'ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase.php', 'ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase.php',
'ArcanistBlacklistedFunctionXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBlacklistedFunctionXHPASTLinterRule.php', 'ArcanistBlacklistedFunctionXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBlacklistedFunctionXHPASTLinterRule.php',
'ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase.php', 'ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase.php',
'ArcanistBlindlyTrustHTTPEngineExtension' => 'configuration/ArcanistBlindlyTrustHTTPEngineExtension.php',
'ArcanistBookmarkWorkflow' => 'workflow/ArcanistBookmarkWorkflow.php', 'ArcanistBookmarkWorkflow' => 'workflow/ArcanistBookmarkWorkflow.php',
'ArcanistBraceFormattingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php', 'ArcanistBraceFormattingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php',
'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBraceFormattingXHPASTLinterRuleTestCase.php', 'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBraceFormattingXHPASTLinterRuleTestCase.php',
@ -450,6 +451,7 @@ phutil_register_library_map(array(
'ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistBinaryNumericScalarCasingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistBlacklistedFunctionXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistBlacklistedFunctionXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistBlacklistedFunctionXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistBlindlyTrustHTTPEngineExtension' => 'PhutilHTTPEngineExtension',
'ArcanistBookmarkWorkflow' => 'ArcanistFeatureWorkflow', 'ArcanistBookmarkWorkflow' => 'ArcanistFeatureWorkflow',
'ArcanistBraceFormattingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistBraceFormattingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',

View file

@ -0,0 +1,27 @@
<?php
final class ArcanistBlindlyTrustHTTPEngineExtension
extends PhutilHTTPEngineExtension {
const EXTENSIONKEY = 'arc.https.blind';
private $domains = array();
public function setDomains(array $domains) {
foreach ($domains as $domain) {
$this->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]);
}
}

View file

@ -100,7 +100,17 @@ final class ArcanistConfigurationManager extends Phobject {
} }
$user_config = $this->readUserArcConfig(); $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) { if ($pval !== null) {
$results[self::CONFIG_SOURCE_USER] = $results[self::CONFIG_SOURCE_USER] =
$settings->willReadValue($key, $pval); $settings->willReadValue($key, $pval);

View file

@ -151,6 +151,7 @@ final class ArcanistDiffUtils extends Phobject {
->setReplaceCost(2) ->setReplaceCost(2)
->setMaximumLength($max) ->setMaximumLength($max)
->setSequences($ov, $nv) ->setSequences($ov, $nv)
->setApplySmoothing(PhutilEditDistanceMatrix::SMOOTHING_INTERNAL)
->getEditString(); ->getEditString();
} }
@ -167,25 +168,6 @@ final class ArcanistDiffUtils extends Phobject {
$result = self::generateEditString($ov, $nv); $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 // 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 // convert into a byte-based description. Walk through the edit string and
// adjust each operation to reflect the number of bytes in the underlying // adjust each operation to reflect the number of bytes in the underlying

View file

@ -60,12 +60,12 @@ final class ArcanistDiffUtilsTestCase extends PhutilTestCase {
array( array(
'abcdefg', 'abcdefg',
'abxdxfg', 'abxdxfg',
'ssxsxss', 'ssxxxss',
), ),
array( array(
'private function a($a, $b) {', 'private function a($a, $b) {',
'public function and($b, $c) {', 'public function and($b, $c) {',
'siixsdddxsssssssssssiissxsssxsss', 'siixxdddxsssssssssssiixxxxxxxsss',
), ),
array( array(

View file

@ -451,6 +451,10 @@ EODIFF;
} }
protected function buildSyntheticAdditionDiff($path, $source, $rev) { protected function buildSyntheticAdditionDiff($path, $source, $rev) {
if (is_dir($this->getPath($path))) {
return null;
}
$type = $this->getSVNProperty($path, 'svn:mime-type'); $type = $this->getSVNProperty($path, 'svn:mime-type');
if ($type == 'application/octet-stream') { if ($type == 'application/octet-stream') {
return <<<EODIFF return <<<EODIFF
@ -462,10 +466,6 @@ svn:mime-type = application/octet-stream
EODIFF; EODIFF;
} }
if (is_dir($this->getPath($path))) {
return null;
}
$data = Filesystem::readFile($this->getPath($path)); $data = Filesystem::readFile($this->getPath($path));
list($orig) = execx('svn cat %s@%s', $source, $rev); list($orig) = execx('svn cat %s@%s', $source, $rev);

View file

@ -59,17 +59,14 @@ EOTEXT
public static function getAliases( public static function getAliases(
ArcanistConfigurationManager $configuration_manager) { ArcanistConfigurationManager $configuration_manager) {
$sources = $configuration_manager->getConfigFromAllSources('aliases');
$working_copy_config_aliases = $aliases = array();
$configuration_manager->getProjectConfig('aliases'); foreach ($sources as $source) {
if (!$working_copy_config_aliases) { $aliases += $source;
$working_copy_config_aliases = array();
} }
$user_config_aliases = idx(
$configuration_manager->readUserConfigurationFile(), return $aliases;
'aliases',
array());
return $user_config_aliases + $working_copy_config_aliases;
} }
private function writeAliases(array $aliases) { private function writeAliases(array $aliases) {

View file

@ -2591,10 +2591,6 @@ EOTEXT
foreach ($need_upload as $key => $spec) { foreach ($need_upload as $key => $spec) {
$change = $need_upload[$key]['change']; $change = $need_upload[$key]['change'];
$type = $spec['type'];
$size = strlen($spec['data']);
$change->setMetadata("{$type}:file:size", $size);
if ($spec['data'] === null) { if ($spec['data'] === null) {
// This covers the case where a file was added or removed; we don't // 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 // need to upload the other half of it (e.g., the old file data for
@ -2604,6 +2600,11 @@ EOTEXT
continue; continue;
} }
$type = $spec['type'];
$size = strlen($spec['data']);
$change->setMetadata("{$type}:file:size", $size);
$mime = $this->getFileMimeType($spec['data']); $mime = $this->getFileMimeType($spec['data']);
if (preg_match('@^image/@', $mime)) { if (preg_match('@^image/@', $mime)) {
$change->setFileType($type_image); $change->setFileType($type_image);