Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94955812
PhabricatorRepositoryVersion.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 11, 16:48
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 13, 16:48 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22903457
Attached To
rPH Phabricator
PhabricatorRepositoryVersion.php
View Options
<?php
final
class
PhabricatorRepositoryVersion
extends
Phobject
{
public
static
function
getMercurialVersion
()
{
list
(
$err
,
$stdout
,
$stderr
)
=
exec_manual
(
'hg --version --quiet'
);
// NOTE: At least on OSX, recent versions of Mercurial report this
// string in this format:
//
// Mercurial Distributed SCM (version 3.1.1+20140916)
$matches
=
null
;
$pattern
=
'/^Mercurial Distributed SCM
\(
version ([
\d
.]+)/m'
;
if
(
preg_match
(
$pattern
,
$stdout
,
$matches
))
{
return
$matches
[
1
];
}
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
,
'>='
);
}
}
Event Timeline
Log In to Comment