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 // it a little bit. In the medium term, we should pull this command stuff // out and use it here and for "Land to ...". $proxy = clone $repository; $proxy->makeEphemeral(); $proxy->setDetail('hosting-enabled', false); $proxy->setDetail('remote-uri', $mirror->getRemoteURI()); $proxy->setCredentialPHID($mirror->getCredentialPHID()); $this->log(pht('Pushing to remote "%s"...', $mirror->getRemoteURI())); if ($proxy->isGit()) { $this->pushToGitRepository($proxy); } else { if ($proxy->isHg()) { $this->pushToHgRepository($proxy); } else { throw new Exception(pht('Unsupported VCS!')); } } }