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

(stable) Promote 2015 Week 37

This commit is contained in:
epriestley 2015-09-13 06:44:52 -07:00
commit 3168583159
14 changed files with 71 additions and 53 deletions

View file

@ -5,7 +5,7 @@ final class ArcanistComposerLinter extends ArcanistLinter {
const LINT_OUT_OF_DATE = 1; const LINT_OUT_OF_DATE = 1;
public function getInfoName() { public function getInfoName() {
return pht('Composer'); return pht('Composer Dependency Manager');
} }
public function getInfoDescription() { public function getInfoDescription() {

View file

@ -6,7 +6,7 @@
final class ArcanistCppcheckLinter extends ArcanistExternalLinter { final class ArcanistCppcheckLinter extends ArcanistExternalLinter {
public function getInfoName() { public function getInfoName() {
return 'Cppcheck'; return 'C++ linter';
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -6,7 +6,7 @@
final class ArcanistCpplintLinter extends ArcanistExternalLinter { final class ArcanistCpplintLinter extends ArcanistExternalLinter {
public function getLinterName() { public function getLinterName() {
return 'CPPLINT'; return 'C++ Google\'s Styleguide';
} }
public function getLinterConfigurationName() { public function getLinterConfigurationName() {

View file

@ -7,7 +7,7 @@
final class ArcanistFlake8Linter extends ArcanistExternalLinter { final class ArcanistFlake8Linter extends ArcanistExternalLinter {
public function getInfoName() { public function getInfoName() {
return 'Flake8'; return 'Python Flake8 multi-linter';
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -6,7 +6,7 @@
final class ArcanistHLintLinter extends ArcanistExternalLinter { final class ArcanistHLintLinter extends ArcanistExternalLinter {
public function getInfoName() { public function getInfoName() {
return 'HLint'; return 'Haskell Linter';
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -9,7 +9,7 @@ final class ArcanistJSHintLinter extends ArcanistExternalLinter {
private $jshintrc; private $jshintrc;
public function getInfoName() { public function getInfoName() {
return 'JSHint'; return 'JavaScript error checking';
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -6,7 +6,7 @@ final class ArcanistJscsLinter extends ArcanistExternalLinter {
private $preset; private $preset;
public function getInfoName() { public function getInfoName() {
return 'JSCS'; return 'JavaScript Code Style';
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -10,7 +10,7 @@ final class ArcanistPyFlakesLinter extends ArcanistExternalLinter {
} }
public function getInfoName() { public function getInfoName() {
return pht('PyFlakes'); return pht('Python PyFlakes');
} }
public function getInfoDescription() { public function getInfoDescription() {

View file

@ -5,7 +5,7 @@ final class ArcanistRuboCopLinter extends ArcanistExternalLinter {
private $config; private $config;
public function getInfoName() { public function getInfoName() {
return 'RuboCop'; return 'Ruby static code analyzer';
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -27,6 +27,8 @@ final class ArcanistFileDataRef extends Phobject {
private $errors = array(); private $errors = array();
private $phid; private $phid;
private $fileHandle; private $fileHandle;
private $deleteAfterEpoch;
private $viewPolicy;
/* -( Configuring File References )---------------------------------------- */ /* -( Configuring File References )---------------------------------------- */
@ -107,6 +109,48 @@ final class ArcanistFileDataRef extends Phobject {
} }
/**
* @task config
*/
public function setViewPolicy($view_policy) {
$this->viewPolicy = $view_policy;
return $this;
}
/**
* @task config
*/
public function getViewPolicy() {
return $this->viewPolicy;
}
/**
* Configure a file to be temporary instead of permanent.
*
* By default, files are retained indefinitely until explicitly deleted. If
* you want to upload a temporary file instead, you can specify an epoch
* timestamp. The file will be deleted after this time.
*
* @param int Epoch timestamp to retain the file until.
* @return this
* @task config
*/
public function setDeleteAfterEpoch($epoch) {
$this->deleteAfterEpoch = $epoch;
return $this;
}
/**
* @task config
*/
public function getDeleteAfterEpoch() {
return $this->deleteAfterEpoch;
}
/* -( Handling Upload Results )-------------------------------------------- */ /* -( Handling Upload Results )-------------------------------------------- */

View file

@ -27,7 +27,6 @@ final class ArcanistFileUploader extends Phobject {
private $conduit; private $conduit;
private $files; private $files;
private $config = array();
/* -( Configuring the Uploader )------------------------------------------- */ /* -( Configuring the Uploader )------------------------------------------- */
@ -79,33 +78,6 @@ final class ArcanistFileUploader extends Phobject {
} }
/**
* Configure a file to be temporary instead of permanent.
*
* By default, files are retained indefinitely until explicitly deleted. If
* you want to upload a temporary file instead, you can specify an epoch
* timestamp. The file will be deleted after this time.
*
* @param string Key identifying the file you want to make temporary, as
* passed to @{method:addFile}.
* @param int Epoch timestamp to retain the file until.
* @return this
* @task add
*/
public function setDeleteFileAfterEpoch($file_key, $epoch) {
if (empty($this->files[$file_key])) {
throw new Exception(
pht(
'No file with given key ("%s") has been added to this uploader.',
$file_key));
}
$this->config[$file_key]['deleteAfterEpoch'] = $epoch;
return $this;
}
/* -( Uploading Files )---------------------------------------------------- */ /* -( Uploading Files )---------------------------------------------------- */
@ -144,19 +116,22 @@ final class ArcanistFileUploader extends Phobject {
$conduit = $this->conduit; $conduit = $this->conduit;
$futures = array(); $futures = array();
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
$config = idx($this->config, $key, array());
$params = array( $params = array(
'name' => $file->getName(), 'name' => $file->getName(),
'contentLength' => $file->getByteSize(), 'contentLength' => $file->getByteSize(),
'contentHash' => $file->getContentHash(), 'contentHash' => $file->getContentHash(),
); );
$delete_after = idx($config, 'deleteAfterEpoch'); $delete_after = $file->getDeleteAfterEpoch();
if ($delete_after !== null) { if ($delete_after !== null) {
$params['deleteAfterEpoch'] = $delete_after; $params['deleteAfterEpoch'] = $delete_after;
} }
$view_policy = $file->getViewPolicy();
if ($view_policy !== null) {
$params['viewPolicy'] = $view_policy;
}
$futures[$key] = $conduit->callMethod('file.allocate', $params); $futures[$key] = $conduit->callMethod('file.allocate', $params);
} }

View file

@ -104,8 +104,8 @@ EOTEXT
$console->writeOut( $console->writeOut(
"<bg:".$color.">** %s **</bg> **%s** (%s)\n", "<bg:".$color.">** %s **</bg> **%s** (%s)\n",
$text, $text,
nonempty($linter['short'], '-'), nonempty($linter['name'], '-'),
$linter['name']); $linter['short']);
if ($linter['exception']) { if ($linter['exception']) {
$console->writeOut( $console->writeOut(
@ -241,11 +241,11 @@ EOTEXT
} }
$linter_info[$key] = array( $linter_info[$key] = array(
'short' => $linter->getLinterConfigurationName(), 'name' => $linter->getLinterConfigurationName(),
'class' => get_class($linter), 'class' => get_class($linter),
'status' => $status, 'status' => $status,
'version' => $version, 'version' => $version,
'name' => $linter->getInfoName(), 'short' => $linter->getInfoName(),
'uri' => $linter->getInfoURI(), 'uri' => $linter->getInfoURI(),
'description' => $linter->getInfoDescription(), 'description' => $linter->getInfoDescription(),
'exception' => $exception, 'exception' => $exception,

View file

@ -53,18 +53,18 @@ EOTEXT
$this->setRepositoryAPI($repository); $this->setRepositoryAPI($repository);
// Require no local changes.
$this->requireCleanWorkingCopy(); $this->requireCleanWorkingCopy();
// Require the library be on master.
$branch_name = $repository->getBranchName(); $branch_name = $repository->getBranchName();
if ($branch_name != 'master') { if ($branch_name != 'master' && $branch_name != 'stable') {
throw new ArcanistUsageException( throw new ArcanistUsageException(
pht( pht(
"%s must be on branch '%s' to be automatically upgraded. ". "%s must be on either branch '%s' or '%s' to be automatically ".
"upgraded. ".
"This copy of %s (in '%s') is on branch '%s'.", "This copy of %s (in '%s') is on branch '%s'.",
$lib, $lib,
'master', 'master',
'stable',
$lib, $lib,
$root, $root,
$branch_name)); $branch_name));

View file

@ -69,13 +69,12 @@ EOTEXT
->setName(basename($path)) ->setName(basename($path))
->setPath($path); ->setPath($path);
$uploader->addFile($file, $key);
if ($is_temporary) { if ($is_temporary) {
$uploader->setDeleteFileAfterEpoch( $expires_at = time() + phutil_units('24 hours in seconds');
$key, $file->setDeleteAfterEpoch($expires_at);
time() + phutil_units('24 hours in seconds'));
} }
$uploader->addFile($file);
} }
$files = $uploader->uploadFiles(); $files = $uploader->uploadFiles();