Page MenuHomePhabricator

D8067.diff
No OneTemporary

D8067.diff

Index: src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
===================================================================
--- src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
+++ src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
@@ -18,6 +18,28 @@
->withRepositoryPHIDs(array($repository->getPHID()))
->execute();
+ $exceptions = array();
+ foreach ($mirrors as $mirror) {
+ try {
+ $this->pushRepositoryToMirror($repository, $mirror);
+ } catch (Exception $ex) {
+ $exceptions[] = $ex;
+ }
+ }
+
+ if ($exceptions) {
+ throw new PhutilAggregateException(
+ pht(
+ 'Exceptions occurred while mirroring the "%s" repository.',
+ $repository->getCallsign()),
+ $exceptions);
+ }
+ }
+
+ private function pushRepositoryToMirror(
+ PhabricatorRepository $repository,
+ PhabricatorRepositoryMirror $mirror) {
+
// TODO: This is a little bit janky, but we don't have first-class
// infrastructure for running remote commands against an arbitrary remote
// right now. Just make an emphemeral copy of the repository and muck with
@@ -28,24 +50,22 @@
$proxy->makeEphemeral();
$proxy->setDetail('hosting-enabled', false);
- foreach ($mirrors as $mirror) {
- $proxy->setDetail('remote-uri', $mirror->getRemoteURI());
- $proxy->setCredentialPHID($mirror->getCredentialPHID());
+ $proxy->setDetail('remote-uri', $mirror->getRemoteURI());
+ $proxy->setCredentialPHID($mirror->getCredentialPHID());
- $this->log(pht('Pushing to remote "%s"...', $mirror->getRemoteURI()));
+ $this->log(pht('Pushing to remote "%s"...', $mirror->getRemoteURI()));
- if (!$proxy->isGit()) {
- throw new Exception('Unsupported VCS!');
- }
+ if (!$proxy->isGit()) {
+ throw new Exception(pht('Unsupported VCS!'));
+ }
- $future = $proxy->getRemoteCommandFuture(
- 'push --verbose --mirror -- %P',
- $proxy->getRemoteURIEnvelope());
+ $future = $proxy->getRemoteCommandFuture(
+ 'push --verbose --mirror -- %P',
+ $proxy->getRemoteURIEnvelope());
- $future
- ->setCWD($proxy->getLocalPath())
- ->resolvex();
- }
+ $future
+ ->setCWD($proxy->getLocalPath())
+ ->resolvex();
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 12:59 AM (18 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6795200
Default Alt Text
D8067.diff (2 KB)

Event Timeline