mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Remove calls to getCallsign() from repository daemons
Summary: Ref T4245. These are all descriptive or UI-facing. Test Plan: - Ran `bin/repository pull ...` with various identifiers. - Ran `bin/repository mirror ...` with various identifiers. - Ran `bin/repository discover ...` with various identifiers. - Ran `bin/phd debug pull X Y --not Z` with various identifiers. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4245 Differential Revision: https://secure.phabricator.com/D14926
This commit is contained in:
parent
1b4f5e38ce
commit
d9e034f02c
4 changed files with 44 additions and 30 deletions
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* By default, the daemon pulls **every** repository. If you want it to be
|
* By default, the daemon pulls **every** repository. If you want it to be
|
||||||
* responsible for only some repositories, you can launch it with a list of
|
* responsible for only some repositories, you can launch it with a list of
|
||||||
* PHIDs or callsigns:
|
* repositories:
|
||||||
*
|
*
|
||||||
* ./phd launch repositorypulllocal -- X Q Z
|
* ./phd launch repositorypulllocal -- X Q Z
|
||||||
*
|
*
|
||||||
|
@ -228,9 +228,8 @@ final class PhabricatorRepositoryPullLocalDaemon
|
||||||
$flags[] = '--no-discovery';
|
$flags[] = '--no-discovery';
|
||||||
}
|
}
|
||||||
|
|
||||||
$callsign = $repository->getCallsign();
|
$monogram = $repository->getMonogram();
|
||||||
|
$future = new ExecFuture('%s update %Ls -- %s', $bin, $flags, $monogram);
|
||||||
$future = new ExecFuture('%s update %Ls -- %s', $bin, $flags, $callsign);
|
|
||||||
|
|
||||||
// Sometimes, the underlying VCS commands will hang indefinitely. We've
|
// Sometimes, the underlying VCS commands will hang indefinitely. We've
|
||||||
// observed this occasionally with GitHub, and other users have observed
|
// observed this occasionally with GitHub, and other users have observed
|
||||||
|
@ -303,30 +302,44 @@ final class PhabricatorRepositoryPullLocalDaemon
|
||||||
->setViewer($this->getViewer());
|
->setViewer($this->getViewer());
|
||||||
|
|
||||||
if ($include) {
|
if ($include) {
|
||||||
$query->withCallsigns($include);
|
$query->withIdentifiers($include);
|
||||||
}
|
}
|
||||||
|
|
||||||
$repositories = $query->execute();
|
$repositories = $query->execute();
|
||||||
|
$repositories = mpull($repositories, null, 'getPHID');
|
||||||
|
|
||||||
if ($include) {
|
if ($include) {
|
||||||
$by_callsign = mpull($repositories, null, 'getCallsign');
|
$map = $query->getIdentifierMap();
|
||||||
foreach ($include as $name) {
|
foreach ($include as $identifier) {
|
||||||
if (empty($by_callsign[$name])) {
|
if (empty($map[$identifier])) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
pht(
|
pht(
|
||||||
"No repository exists with callsign '%s'!",
|
'No repository "%s" exists!',
|
||||||
$name));
|
$identifier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exclude) {
|
if ($exclude) {
|
||||||
$exclude = array_fuse($exclude);
|
$xquery = id(new PhabricatorRepositoryQuery())
|
||||||
foreach ($repositories as $key => $repository) {
|
->setViewer($this->getViewer())
|
||||||
if (isset($exclude[$repository->getCallsign()])) {
|
->withIdentifiers($exclude);
|
||||||
unset($repositories[$key]);
|
|
||||||
|
$excluded_repos = $xquery->execute();
|
||||||
|
$xmap = $xquery->getIdentifierMap();
|
||||||
|
|
||||||
|
foreach ($exclude as $identifier) {
|
||||||
|
if (empty($xmap[$identifier])) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'No repository "%s" exists!',
|
||||||
|
$identifier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($excluded_repos as $excluded_repo) {
|
||||||
|
unset($repositories[$excluded_repo->getPHID()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($repositories as $key => $repository) {
|
foreach ($repositories as $key => $repository) {
|
||||||
|
|
|
@ -100,8 +100,8 @@ final class PhabricatorRepositoryDiscoveryEngine
|
||||||
|
|
||||||
$this->log(
|
$this->log(
|
||||||
pht(
|
pht(
|
||||||
'Discovering commits in repository %s.',
|
'Discovering commits in repository "%s".',
|
||||||
$repository->getCallsign()));
|
$repository->getDisplayName()));
|
||||||
|
|
||||||
$this->fillCommitCache(array_values($branches));
|
$this->fillCommitCache(array_values($branches));
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ final class PhabricatorRepositoryDiscoveryEngine
|
||||||
'configured URI is "%s". To resolve this error, set the remote URI '.
|
'configured URI is "%s". To resolve this error, set the remote URI '.
|
||||||
'to point at the repository root. If you want to import only part '.
|
'to point at the repository root. If you want to import only part '.
|
||||||
'of a Subversion repository, use the "Import Only" option.',
|
'of a Subversion repository, use the "Import Only" option.',
|
||||||
$repository->getCallsign(),
|
$repository->getDisplayName(),
|
||||||
$remote_root,
|
$remote_root,
|
||||||
$expect_root));
|
$expect_root));
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ final class PhabricatorRepositoryMirrorEngine
|
||||||
throw new PhutilAggregateException(
|
throw new PhutilAggregateException(
|
||||||
pht(
|
pht(
|
||||||
'Exceptions occurred while mirroring the "%s" repository.',
|
'Exceptions occurred while mirroring the "%s" repository.',
|
||||||
$repository->getCallsign()),
|
$repository->getDisplayName()),
|
||||||
$exceptions);
|
$exceptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ final class PhabricatorRepositoryPullEngine
|
||||||
$is_svn = false;
|
$is_svn = false;
|
||||||
|
|
||||||
$vcs = $repository->getVersionControlSystem();
|
$vcs = $repository->getVersionControlSystem();
|
||||||
$callsign = $repository->getCallsign();
|
|
||||||
|
|
||||||
switch ($vcs) {
|
switch ($vcs) {
|
||||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||||
|
@ -37,9 +36,9 @@ final class PhabricatorRepositoryPullEngine
|
||||||
if (!$repository->isHosted()) {
|
if (!$repository->isHosted()) {
|
||||||
$this->skipPull(
|
$this->skipPull(
|
||||||
pht(
|
pht(
|
||||||
"Repository '%s' is a non-hosted Subversion repository, which ".
|
'Repository "%s" is a non-hosted Subversion repository, which '.
|
||||||
"does not require a local working copy to be pulled.",
|
'does not require a local working copy to be pulled.',
|
||||||
$callsign));
|
$repository->getDisplayName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$is_svn = true;
|
$is_svn = true;
|
||||||
|
@ -55,13 +54,12 @@ final class PhabricatorRepositoryPullEngine
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$callsign = $repository->getCallsign();
|
|
||||||
$local_path = $repository->getLocalPath();
|
$local_path = $repository->getLocalPath();
|
||||||
if ($local_path === null) {
|
if ($local_path === null) {
|
||||||
$this->abortPull(
|
$this->abortPull(
|
||||||
pht(
|
pht(
|
||||||
"No local path is configured for repository '%s'.",
|
'No local path is configured for repository "%s".',
|
||||||
$callsign));
|
$repository->getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -73,8 +71,8 @@ final class PhabricatorRepositoryPullEngine
|
||||||
if (!Filesystem::pathExists($local_path)) {
|
if (!Filesystem::pathExists($local_path)) {
|
||||||
$this->logPull(
|
$this->logPull(
|
||||||
pht(
|
pht(
|
||||||
"Creating a new working copy for repository '%s'.",
|
'Creating a new working copy for repository "%s".',
|
||||||
$callsign));
|
$repository->getDisplayName()));
|
||||||
if ($is_git) {
|
if ($is_git) {
|
||||||
$this->executeGitCreate();
|
$this->executeGitCreate();
|
||||||
} else if ($is_hg) {
|
} else if ($is_hg) {
|
||||||
|
@ -86,8 +84,8 @@ final class PhabricatorRepositoryPullEngine
|
||||||
if (!$repository->isHosted()) {
|
if (!$repository->isHosted()) {
|
||||||
$this->logPull(
|
$this->logPull(
|
||||||
pht(
|
pht(
|
||||||
"Updating the working copy for repository '%s'.",
|
'Updating the working copy for repository "%s".',
|
||||||
$callsign));
|
$repository->getDisplayName()));
|
||||||
if ($is_git) {
|
if ($is_git) {
|
||||||
$this->verifyGitOrigin($repository);
|
$this->verifyGitOrigin($repository);
|
||||||
$this->executeGitUpdate();
|
$this->executeGitUpdate();
|
||||||
|
@ -113,7 +111,10 @@ final class PhabricatorRepositoryPullEngine
|
||||||
|
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$this->abortPull(
|
$this->abortPull(
|
||||||
pht('Pull of "%s" failed: %s', $callsign, $ex->getMessage()),
|
pht(
|
||||||
|
"Pull of '%s' failed: %s",
|
||||||
|
$repository->getDisplayName(),
|
||||||
|
$ex->getMessage()),
|
||||||
$ex);
|
$ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue