Differential D14253 Diff 34434 src/applications/repository/constants/PhabricatorRepositoryVersion.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/constants/PhabricatorRepositoryVersion.php
Show All 13 Lines | public static function getMercurialVersion() { | ||||
$pattern = '/^Mercurial Distributed SCM \(version ([\d.]+)/m'; | $pattern = '/^Mercurial Distributed SCM \(version ([\d.]+)/m'; | ||||
if (preg_match($pattern, $stdout, $matches)) { | if (preg_match($pattern, $stdout, $matches)) { | ||||
return $matches[1]; | return $matches[1]; | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
/** | |||||
* The `locate` command is deprecated as of Mercurial 3.2, to be | |||||
* replaced with `files` command, which supports most of the same | |||||
* arguments. This determines whether the new `files` command should | |||||
* be used instead of the `locate` command. | |||||
* | |||||
* @param string $mercurial_version - The current version of mercurial | |||||
* which can be retrieved by calling: | |||||
* PhabricatorRepositoryVersion::getMercurialVersion() | |||||
* | |||||
* @return boolean True if the version of Mercurial is new enough to support | |||||
* the `files` command, or false if otherwise. | |||||
*/ | |||||
public static function isMercurialFilesCommandAvailable($mercurial_version) { | |||||
$min_version_for_files = '3.2'; | |||||
return version_compare($mercurial_version, $min_version_for_files, '>='); | |||||
} | |||||
} | } |