Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php
index 808986f9aa..5fd811e210 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php
@@ -1,51 +1,58 @@
<?php
final class PhabricatorRepositoryManagementPullWorkflow
extends PhabricatorRepositoryManagementWorkflow {
protected function didConstruct() {
$this
->setName('pull')
->setExamples('**pull** __repository__ ...')
->setSynopsis(pht('Pull __repository__.'))
->setArguments(
array(
array(
'name' => 'verbose',
'help' => pht('Show additional debugging information.'),
),
+ array(
+ 'name' => 'ignore-locality',
+ 'help' => pht(
+ 'Pull even if the repository should not be present on this '.
+ 'host according to repository cluster configuration.'),
+ ),
array(
'name' => 'repos',
'wildcard' => true,
),
));
}
public function execute(PhutilArgumentParser $args) {
- $repos = $this->loadLocalRepositories($args, 'repos');
+ $ignore_locality = (bool)$args->getArg('ignore-locality');
+ $repos = $this->loadLocalRepositories($args, 'repos', $ignore_locality);
if (!$repos) {
throw new PhutilArgumentUsageException(
pht('Specify one or more repositories to pull.'));
}
$console = PhutilConsole::getConsole();
foreach ($repos as $repo) {
$console->writeOut(
"%s\n",
pht(
'Pulling "%s"...',
$repo->getDisplayName()));
id(new PhabricatorRepositoryPullEngine())
->setRepository($repo)
->setVerbose($args->getArg('verbose'))
->pullRepository();
}
$console->writeOut("%s\n", pht('Done.'));
return 0;
}
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php
index 6d48d7c5d1..3afde4d690 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php
@@ -1,95 +1,100 @@
<?php
abstract class PhabricatorRepositoryManagementWorkflow
extends PhabricatorManagementWorkflow {
protected function loadRepositories(PhutilArgumentParser $args, $param) {
$identifiers = $args->getArg($param);
if (!$identifiers) {
return array();
}
$query = id(new PhabricatorRepositoryQuery())
->setViewer($this->getViewer())
->needURIs(true)
->withIdentifiers($identifiers);
$query->execute();
$map = $query->getIdentifierMap();
foreach ($identifiers as $identifier) {
if (empty($map[$identifier])) {
throw new PhutilArgumentUsageException(
pht(
'Repository "%s" does not exist!',
$identifier));
}
}
// Reorder repositories according to argument order.
$repositories = array_select_keys($map, $identifiers);
return array_values($repositories);
}
protected function loadLocalRepositories(
PhutilArgumentParser $args,
- $param) {
+ $param,
+ $ignore_locality = false) {
$repositories = $this->loadRepositories($args, $param);
if (!$repositories) {
return $repositories;
}
+ if ($ignore_locality) {
+ return $repositories;
+ }
+
$device = AlmanacKeys::getLiveDevice();
$viewer = $this->getViewer();
$filter = id(new DiffusionLocalRepositoryFilter())
->setViewer($viewer)
->setDevice($device)
->setRepositories($repositories);
$repositories = $filter->execute();
foreach ($filter->getRejectionReasons() as $reason) {
throw new PhutilArgumentUsageException($reason);
}
return $repositories;
}
protected function loadCommits(PhutilArgumentParser $args, $param) {
$names = $args->getArg($param);
if (!$names) {
return null;
}
return $this->loadNamedCommits($names);
}
protected function loadNamedCommit($name) {
$map = $this->loadNamedCommits(array($name));
return $map[$name];
}
protected function loadNamedCommits(array $names) {
$query = id(new DiffusionCommitQuery())
->setViewer($this->getViewer())
->withIdentifiers($names);
$query->execute();
$map = $query->getIdentifierMap();
foreach ($names as $name) {
if (empty($map[$name])) {
throw new PhutilArgumentUsageException(
pht('Commit "%s" does not exist or is ambiguous.', $name));
}
}
return $map;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 26, 3:56 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1211
Default Alt Text
(4 KB)

Event Timeline