From 0965f0041a5c12a65a10f15ca1a52b831f1ed198 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 26 Oct 2013 14:44:12 -0700 Subject: [PATCH] Don't pull updates for repositories marked as hosted Summary: - Don't try to pull hosted repos. - Also, fix the `--verbose` + `--trace` interaction for `bin/repository`. - Also, fix a couple of unit tests which got tweaked earlier. Test Plan: $ ./bin/repository pull GTEST --verbose Pulling 'GTEST'... Repository "GTEST" is hosted, so Phabricator does not pull updates for it. Done. Reviewers: btrahan, hach-que Reviewed By: hach-que CC: aran Maniphest Tasks: T2230 Differential Revision: https://secure.phabricator.com/D7427 --- .../daemon/PhabricatorRepositoryPullLocalDaemon.php | 3 ++- .../repository/engine/PhabricatorRepositoryEngine.php | 3 ++- .../engine/PhabricatorRepositoryPullEngine.php | 10 ++++++++++ .../__tests__/PhabricatorWorkingCopyTestCase.php | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 503b4a7bc0..c96af491f9 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -128,7 +128,8 @@ final class PhabricatorRepositoryPullLocalDaemon if (!$no_discovery) { // TODO: It would be nice to discover only if we pulled something, - // but this isn't totally trivial. + // but this isn't totally trivial. It's slightly more complicated + // with hosted repositories, too. $lock_name = get_class($this).':'.$callsign; $lock = PhabricatorGlobalLock::newLock($lock_name); diff --git a/src/applications/repository/engine/PhabricatorRepositoryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryEngine.php index 60b8a9584c..7685a91ee5 100644 --- a/src/applications/repository/engine/PhabricatorRepositoryEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryEngine.php @@ -54,7 +54,8 @@ abstract class PhabricatorRepositoryEngine { if ($this->getVerbose()) { $console = PhutilConsole::getConsole(); $argv = func_get_args(); - call_user_func_array(array($console, 'writeLog'), $argv); + $argv[0] = $argv[0]."\n"; + call_user_func_array(array($console, 'writeOut'), $argv); } return $this; } diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php index 777e1e0a11..2f2824aa62 100644 --- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php @@ -25,6 +25,16 @@ final class PhabricatorRepositoryPullEngine $vcs = $repository->getVersionControlSystem(); $callsign = $repository->getCallsign(); + + if ($repository->isHosted()) { + $this->log( + pht( + 'Repository "%s" is hosted, so Phabricator does not pull updates '. + 'for it.', + $callsign)); + return; + } + switch ($vcs) { case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: // We never pull a local copy of Subversion repositories. diff --git a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php index a8f160cd94..336a8fe89d 100644 --- a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php +++ b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php @@ -45,7 +45,8 @@ abstract class PhabricatorWorkingCopyTestCase extends PhabricatorTestCase { $dir = PhutilDirectoryFixture::newFromArchive($path); $local = new TempFile('.ignore'); - $repo = id(new PhabricatorRepository()) + $user = $this->generateNewTestUser(); + $repo = PhabricatorRepository::initializeNewRepository($user) ->setCallsign($callsign) ->setName(pht('Test Repo "%s"', $callsign)) ->setVersionControlSystem($vcs_type)