mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-29 17:00:58 +01:00
(stable) Promote 2016 Week 23
This commit is contained in:
commit
9c412dabf6
9 changed files with 61 additions and 40 deletions
|
@ -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) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
||||
|
|
|
@ -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 <<<EODIFF
|
||||
|
@ -462,10 +466,6 @@ svn:mime-type = application/octet-stream
|
|||
EODIFF;
|
||||
}
|
||||
|
||||
if (is_dir($this->getPath($path))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$data = Filesystem::readFile($this->getPath($path));
|
||||
list($orig) = execx('svn cat %s@%s', $source, $rev);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue