Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
<?php
|
|
|
|
|
2015-01-02 05:27:45 +01:00
|
|
|
final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck {
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
|
2015-02-10 21:53:00 +01:00
|
|
|
public function getDefaultGroup() {
|
|
|
|
return self::GROUP_OTHER;
|
|
|
|
}
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
|
|
|
|
protected function executeChecks() {
|
|
|
|
if (phutil_is_windows()) {
|
|
|
|
$bin_name = 'where';
|
|
|
|
} else {
|
|
|
|
$bin_name = 'which';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Filesystem::binaryExists($bin_name)) {
|
|
|
|
$message = pht(
|
|
|
|
"Without '%s', Phabricator can not test for the availability ".
|
|
|
|
"of other binaries.",
|
|
|
|
$bin_name);
|
|
|
|
$this->raiseWarning($bin_name, $message);
|
|
|
|
|
|
|
|
// We need to return here if we can't find the 'which' / 'where' binary
|
|
|
|
// because the other tests won't be valid.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Filesystem::binaryExists('diff')) {
|
|
|
|
$message = pht(
|
2015-05-22 09:27:56 +02:00
|
|
|
"Without '%s', Phabricator will not be able to generate or render ".
|
|
|
|
"diffs in multiple applications.",
|
|
|
|
'diff');
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
$this->raiseWarning('diff', $message);
|
|
|
|
} else {
|
|
|
|
$tmp_a = new TempFile();
|
|
|
|
$tmp_b = new TempFile();
|
|
|
|
$tmp_c = new TempFile();
|
|
|
|
|
|
|
|
Filesystem::writeFile($tmp_a, 'A');
|
|
|
|
Filesystem::writeFile($tmp_b, 'A');
|
|
|
|
Filesystem::writeFile($tmp_c, 'B');
|
|
|
|
|
|
|
|
list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_b);
|
|
|
|
if ($err) {
|
|
|
|
$this->newIssue('bin.diff.same')
|
2015-05-22 09:27:56 +02:00
|
|
|
->setName(pht("Unexpected '%s' Behavior", 'diff'))
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
->setMessage(
|
|
|
|
pht(
|
2015-05-22 09:27:56 +02:00
|
|
|
"The '%s' binary on this system has unexpected behavior: ".
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
"it was expected to exit without an error code when passed ".
|
|
|
|
"identical files, but exited with code %d.",
|
2015-05-22 09:27:56 +02:00
|
|
|
'diff',
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
$err));
|
|
|
|
}
|
|
|
|
|
|
|
|
list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_c);
|
|
|
|
if (!$err) {
|
|
|
|
$this->newIssue('bin.diff.diff')
|
|
|
|
->setName(pht("Unexpected 'diff' Behavior"))
|
|
|
|
->setMessage(
|
|
|
|
pht(
|
2015-05-22 09:27:56 +02:00
|
|
|
"The '%s' binary on this system has unexpected behavior: ".
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
"it was expected to exit with a nonzero error code when passed ".
|
2015-05-22 09:27:56 +02:00
|
|
|
"differing files, but did not.",
|
|
|
|
'diff'));
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
}
|
|
|
|
}
|
2013-05-27 22:40:34 +02:00
|
|
|
|
|
|
|
$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);
|
|
|
|
}
|
2014-11-14 23:58:18 +01:00
|
|
|
|
2015-01-29 23:28:49 +01:00
|
|
|
$version = null;
|
2014-11-14 23:58:18 +01:00
|
|
|
switch ($binary) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
$minimum_version = null;
|
|
|
|
$bad_versions = array();
|
|
|
|
list($err, $stdout, $stderr) = exec_manual('git --version');
|
|
|
|
$version = trim(substr($stdout, strlen('git version ')));
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
2015-02-10 21:07:18 +01:00
|
|
|
$minimum_version = '1.5';
|
2014-11-14 23:58:18 +01:00
|
|
|
$bad_versions = array(
|
2015-04-05 14:29:39 +02:00
|
|
|
'1.7.1' => pht(
|
|
|
|
'This version of Subversion has a bug where `%s` does not work '.
|
|
|
|
'for files added in rN (Subversion issue #2873), fixed in 1.7.2.',
|
|
|
|
'svn diff -c N'),
|
|
|
|
);
|
2014-11-14 23:58:18 +01:00
|
|
|
list($err, $stdout, $stderr) = exec_manual('svn --version --quiet');
|
|
|
|
$version = trim($stdout);
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$minimum_version = '1.9';
|
|
|
|
$bad_versions = array(
|
2015-04-05 14:29:39 +02:00
|
|
|
'2.1' => pht(
|
|
|
|
'This version of Mercurial returns a bad exit code '.
|
|
|
|
'after a successful pull.'),
|
|
|
|
'2.2' => pht(
|
|
|
|
'This version of Mercurial has a significant memory leak, fixed '.
|
|
|
|
'in 2.2.1. Pushing fails with this version as well; see %s.',
|
|
|
|
'T3046#54922'),
|
|
|
|
);
|
2015-03-20 17:26:32 +01:00
|
|
|
$version = PhabricatorRepositoryVersion::getMercurialVersion();
|
2015-01-29 23:28:49 +01:00
|
|
|
break;
|
2014-11-14 23:58:18 +01:00
|
|
|
}
|
|
|
|
|
2015-01-29 23:28:49 +01:00
|
|
|
if ($version === null) {
|
|
|
|
$this->raiseUnknownVersionWarning($binary);
|
|
|
|
} else {
|
|
|
|
if ($minimum_version &&
|
|
|
|
version_compare($version, $minimum_version, '<')) {
|
|
|
|
$this->raiseMinimumVersionWarning(
|
2014-11-14 23:58:18 +01:00
|
|
|
$binary,
|
2015-01-29 23:28:49 +01:00
|
|
|
$minimum_version,
|
|
|
|
$version);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($bad_versions as $bad_version => $details) {
|
|
|
|
if ($bad_version === $version) {
|
|
|
|
$this->raiseBadVersionWarning(
|
|
|
|
$binary,
|
|
|
|
$bad_version);
|
|
|
|
}
|
2014-11-14 23:58:18 +01:00
|
|
|
}
|
|
|
|
}
|
2013-05-27 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private function raiseWarning($bin, $message) {
|
|
|
|
if (phutil_is_windows()) {
|
|
|
|
$preamble = pht(
|
|
|
|
"The '%s' binary could not be found. Set the webserver's %s ".
|
|
|
|
"environmental variable to include the directory where it resides, or ".
|
|
|
|
"add that directory to '%s' in the Phabricator configuration.",
|
|
|
|
$bin,
|
|
|
|
'PATH',
|
|
|
|
'environment.append-paths');
|
|
|
|
} else {
|
|
|
|
$preamble = pht(
|
|
|
|
"The '%s' binary could not be found. Symlink it into '%s', or set the ".
|
|
|
|
"webserver's %s environmental variable to include the directory where ".
|
|
|
|
"it resides, or add that directory to '%s' in the Phabricator ".
|
|
|
|
"configuration.",
|
|
|
|
$bin,
|
|
|
|
'phabricator/support/bin/',
|
|
|
|
'PATH',
|
|
|
|
'environment.append-paths');
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->newIssue('bin.'.$bin)
|
|
|
|
->setShortName(pht("'%s' Missing", $bin))
|
|
|
|
->setName(pht("Missing '%s' Binary", $bin))
|
|
|
|
->setSummary(
|
2013-09-26 14:21:43 +02:00
|
|
|
pht("The '%s' binary could not be located or executed.", $bin))
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
->setMessage($preamble.' '.$message)
|
|
|
|
->addPhabricatorConfig('environment.append-paths');
|
|
|
|
}
|
|
|
|
|
2015-01-29 23:28:49 +01:00
|
|
|
private function raiseUnknownVersionWarning($binary) {
|
|
|
|
$summary = pht(
|
|
|
|
'Unable to determine the version number of "%s".',
|
|
|
|
$binary);
|
|
|
|
|
|
|
|
$message = pht(
|
|
|
|
'Unable to determine the version number of "%s". Usually, this means '.
|
|
|
|
'the program changed its version format string recently and Phabricator '.
|
|
|
|
'does not know how to parse the new one yet, but might indicate that '.
|
|
|
|
'you have a very old (or broken) binary.'.
|
|
|
|
"\n\n".
|
|
|
|
'Because we can not determine the version number, checks against '.
|
|
|
|
'minimum and known-bad versions will be skipped, so we might fail '.
|
|
|
|
'to detect an incompatible binary.'.
|
|
|
|
"\n\n".
|
|
|
|
'You may be able to resolve this issue by updating Phabricator, since '.
|
|
|
|
'a newer version of Phabricator is likely to be able to parse the '.
|
|
|
|
'newer version string.'.
|
|
|
|
"\n\n".
|
|
|
|
'If updating Phabricator does not fix this, you can report the issue '.
|
|
|
|
'to the upstream so we can adjust the parser.'.
|
|
|
|
"\n\n".
|
|
|
|
'If you are confident you have a recent version of "%s" installed and '.
|
|
|
|
'working correctly, it is usually safe to ignore this warning.',
|
|
|
|
$binary,
|
|
|
|
$binary);
|
|
|
|
|
|
|
|
$this->newIssue('bin.'.$binary.'.unknown-version')
|
|
|
|
->setShortName(pht("Unknown '%s' Version", $binary))
|
|
|
|
->setName(pht("Unknown '%s' Version", $binary))
|
|
|
|
->setSummary($summary)
|
|
|
|
->setMessage($message)
|
|
|
|
->addLink(
|
|
|
|
PhabricatorEnv::getDoclink('Contributing Bug Reports'),
|
|
|
|
pht('Report this Issue to the Upstream'));
|
|
|
|
}
|
|
|
|
|
2014-11-14 23:58:18 +01:00
|
|
|
private function raiseMinimumVersionWarning(
|
|
|
|
$binary,
|
|
|
|
$minimum_version,
|
|
|
|
$version) {
|
|
|
|
|
|
|
|
switch ($binary) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$summary = pht(
|
|
|
|
"The '%s' binary is version %s and Phabricator requires version ".
|
|
|
|
"%s or higher.",
|
|
|
|
$binary,
|
|
|
|
$version,
|
|
|
|
$minimum_version);
|
|
|
|
$message = pht(
|
|
|
|
"Please upgrade the '%s' binary to a more modern version.",
|
|
|
|
$binary);
|
|
|
|
$this->newIssue('bin.'.$binary)
|
|
|
|
->setShortName(pht("Unsupported '%s' Version", $binary))
|
|
|
|
->setName(pht("Unsupported '%s' Version", $binary))
|
|
|
|
->setSummary($summary)
|
|
|
|
->setMessage($summary.' '.$message);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function raiseBadVersionWarning($binary, $bad_version) {
|
|
|
|
switch ($binary) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$summary = pht(
|
|
|
|
"The '%s' binary is version %s which has bugs that break ".
|
|
|
|
"Phabricator.",
|
|
|
|
$binary,
|
|
|
|
$bad_version);
|
|
|
|
$message = pht(
|
|
|
|
"Please upgrade the '%s' binary to a more modern version.",
|
|
|
|
$binary);
|
|
|
|
$this->newIssue('bin.'.$binary)
|
|
|
|
->setShortName(pht("Unsupported '%s' Version", $binary))
|
|
|
|
->setName(pht("Unsupported '%s' Version", $binary))
|
|
|
|
->setSummary($summary)
|
|
|
|
->setMessage($summary.' '.$message);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
}
|