From 3fdb1a2bc437e65f266321cbb94c2a3f4920afcf Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 10 May 2016 07:13:44 -0700 Subject: [PATCH] Improve behavior for not-yet-created non-cluster repositories Summary: Fixes T10815. We already recovered reasonably from this for cluster repositories, but not for non-cluster repositories. Test Plan: - Viewed cluster and non-cluster empty Git repository. - Viewed cluster and non-cluster empty Mercurial repository. - Viewed cluster and non-clsuter empty hosted SVN repository. - Viewed cluster and non-cluster empty observed SVN repository. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10815 Differential Revision: https://secure.phabricator.com/D15878 --- .../query/lowlevel/DiffusionLowLevelResolveRefsQuery.php | 5 +++++ .../repository/storage/PhabricatorRepository.php | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php index 53dc6b30da..4e9ed246d9 100644 --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php @@ -31,6 +31,11 @@ final class DiffusionLowLevelResolveRefsQuery return array(); } + $repository = $this->getRepository(); + if (!$repository->hasLocalWorkingCopy()) { + return array(); + } + switch ($this->getRepository()->getVersionControlSystem()) { case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: $result = $this->resolveGitRefs(); diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index 5705bb719c..f23661cfbe 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -1477,6 +1477,15 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO return false; } + public function hasLocalWorkingCopy() { + try { + self::assertLocalExists(); + return true; + } catch (Exception $ex) { + return false; + } + } + /** * Raise more useful errors when there are basic filesystem problems. */