From 6551ea82457c36a17d20480d31694510804e2737 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 27 May 2013 13:40:34 -0700 Subject: [PATCH] Detect missing 'svn', 'hg' and 'git' during setup Summary: These are a bit tricky because we don't want to require you to install a VCS you don't use just to use Phabricator. Test that repositories exist before performing the checks. I'll couple this with additional checks during repository creation. Test Plan: Changed binary names to nonexistent ones, verified setup issues raised properly. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6040 --- .../check/PhabricatorSetupCheckBinaries.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/applications/config/check/PhabricatorSetupCheckBinaries.php b/src/applications/config/check/PhabricatorSetupCheckBinaries.php index 1040484948..f6a714b856 100644 --- a/src/applications/config/check/PhabricatorSetupCheckBinaries.php +++ b/src/applications/config/check/PhabricatorSetupCheckBinaries.php @@ -60,6 +60,40 @@ final class PhabricatorSetupCheckBinaries extends PhabricatorSetupCheck { "differing files, but did not.")); } } + + $table = new PhabricatorRepository(); + $vcses = queryfx_all( + $table->establishConnection('r'), + 'SELECT DISTINCT versionControlSystem FROM %T', + $table->getTableName()); + + foreach ($vcses as $vcs) { + switch ($vcs['versionControlSystem']) { + case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: + $binary = 'git'; + break; + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: + $binary = 'svn'; + break; + case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: + $binary = 'hg'; + break; + default: + $binary = null; + break; + } + if (!$binary) { + continue; + } + + if (!Filesystem::binaryExists($binary)) { + $message = pht( + 'You have at least one repository configured which uses this '. + 'version control system. It will not work without the VCS binary.'); + $this->raiseWarning($binary, $message); + } + } + } private function raiseWarning($bin, $message) {