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

Use new FutureIterator instead of Futures

Summary: Ref T6829. Deprecate the `Futures()` function.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T6829

Differential Revision: https://secure.phabricator.com/D11079
This commit is contained in:
Joshua Spence 2014-12-30 23:14:32 +11:00
parent 841556134f
commit 721bdf424b
11 changed files with 39 additions and 17 deletions

View file

@ -184,7 +184,9 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
public function didRunLinters() {
if ($this->futures) {
foreach (Futures($this->futures)->limit(8) as $future) {
$futures = id(new FutureIterator($this->futures))
->limit(8);
foreach ($futures as $future) {
$this->resolveFuture($future);
}
}

View file

@ -13,7 +13,7 @@ abstract class ArcanistFutureLinter extends ArcanistLinter {
final public function willLintPaths(array $paths) {
$limit = $this->getFuturesLimit();
$this->futures = Futures(array())->limit($limit);
$this->futures = id(new FutureIterator(array()))->limit($limit);
foreach ($this->buildFutures($paths) as $path => $future) {
$this->futures->addFuture($future, $path);
}

View file

@ -187,7 +187,9 @@ final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
$futures[$path] = $future;
}
foreach (Futures($futures)->limit(4) as $path => $future) {
$futures = id(new FutureIterator($futures))
->limit(4);
foreach ($futures as $path => $future) {
list($stdout) = $future->resolvex();
$this->output[$path] = $stdout;
}

View file

@ -609,7 +609,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
// After the other commands exit, we can start the `diff-files` command.
);
Futures($futures)->resolveAll();
id(new FutureIterator($futures))->resolveAll();
// We're clear to start the `git diff-files` now.
$unstaged_future->start();

View file

@ -284,7 +284,9 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
$last_node = $node;
}
foreach (Futures($futures)->limit(4) as $node => $future) {
$futures = id(new FutureIterator($futures))
->limit(4);
foreach ($futures as $node => $future) {
list($parents) = $future->resolvex();
$parents = array_filter(explode("\n", $parents));
$commits[$node]['parents'] = $parents;

View file

@ -59,7 +59,9 @@ final class NoseTestEngine extends ArcanistUnitTestEngine {
}
$results = array();
foreach (Futures($futures)->limit(4) as $test_path => $future) {
$futures = id(new FutureIterator($futures))
->limit(4);
foreach ($futures as $test_path => $future) {
try {
list($stdout, $stderr) = $future->resolvex();
} catch(CommandException $exc) {

View file

@ -73,7 +73,9 @@ final class PhpunitTestEngine extends ArcanistUnitTestEngine {
}
$results = array();
foreach (Futures($futures)->limit(4) as $test => $future) {
$futures = id(new FutureIterator($futures))
->limit(4);
foreach ($futures as $test => $future) {
list($err, $stdout, $stderr) = $future->resolve();

View file

@ -277,7 +277,7 @@ class XUnitTestEngine extends ArcanistUnitTestEngine {
dirname($test_assembly['project'])));
$build_futures[$test_assembly['project']] = $build_future;
}
$iterator = Futures($build_futures)->limit(1);
$iterator = id(new FutureIterator($build_futures))->limit(1);
foreach ($iterator as $test_assembly => $future) {
$result = new ArcanistUnitTestResult();
$result->setName('(build) '.$test_assembly);
@ -353,7 +353,9 @@ class XUnitTestEngine extends ArcanistUnitTestEngine {
}
// Run all of the tests.
foreach (Futures($futures)->limit(8) as $test_assembly => $future) {
$futures = id(new FutureIterator($futures))
->limit(8);
foreach ($futures as $test_assembly => $future) {
list($err, $stdout, $stderr) = $future->resolve();
if (file_exists($outputs[$test_assembly])) {

View file

@ -1135,7 +1135,9 @@ EOTEXT
$targets[] = array('command' => 'info', 'path' => $path);
}
foreach (Futures($futures)->limit(8) as $key => $future) {
$futures = id(new FutureIterator($futures))
->limit(8);
foreach ($futures as $key => $future) {
$target = $targets[$key];
if ($target['command'] == 'diff') {
$repository_api->primeSVNDiffResult(
@ -1774,7 +1776,7 @@ EOTEXT
));
}
foreach (Futures($futures) as $key => $future) {
foreach (new FutureIterator($futures) as $key => $future) {
$result = $future->resolve();
switch ($key) {
case 'revision':
@ -2393,7 +2395,8 @@ EOTEXT
* @task diffprop
*/
private function resolveDiffPropertyUpdates() {
Futures($this->diffPropertyFutures)->resolveAll();
id(new FutureIterator($this->diffPropertyFutures))
->resolveAll();
$this->diffPropertyFutures = array();
}
@ -2522,7 +2525,9 @@ EOTEXT
));
}
foreach (Futures($hash_futures)->limit(8) as $key => $future) {
$futures = id(new FutureIterator($hash_futures))
->limit(8);
foreach ($futures as $key => $future) {
$type = $need_upload[$key]['type'];
$change = $need_upload[$key]['change'];
$name = $need_upload[$key]['name'];
@ -2553,7 +2558,9 @@ EOTEXT
));
}
foreach (Futures($upload_futures)->limit(4) as $key => $future) {
$futures = id(new FutureIterator($upload_futures))
->limit(4);
foreach ($futures as $key => $future) {
$type = $need_upload[$key]['type'];
$change = $need_upload[$key]['change'];
$name = $need_upload[$key]['name'];

View file

@ -191,7 +191,9 @@ EOTEXT
$branches = ipull($branches, null, 'name');
foreach (Futures($futures)->limit(16) as $name => $future) {
$futures = id(new FutureIterator($futures))
->limit(16);
foreach ($futures as $name => $future) {
list($info) = $future->resolvex();
list($hash, $epoch, $tree, $desc, $text) = explode("\1", trim($info), 5);
@ -250,7 +252,7 @@ EOTEXT
}
$results = array();
foreach (Futures($calls) as $call) {
foreach (new FutureIterator($calls) as $call) {
$results[] = $call->resolve();
}

View file

@ -113,7 +113,8 @@ EOTEXT
));
}
Futures($futures)->resolveAll();
id(new FutureIterator($futures))
->resolveAll();
return 0;
}