Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14104890
D8067.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8067.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8067: If repository mirroring fails, keep trying the other mirrors
Attached
Detach File
Event Timeline
Log In to Comment