mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
Update templates used with mercurial to remove '--debug'
Summary: Refs D21679 (phabricator changes) This updates Arcanist to be able to check whether the version of Mercurial supports using `{p1.node}` template format vs. `{p1node}`. Test Plan: Tested under coverage from D21679 Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D21681
This commit is contained in:
parent
c94c5bbf35
commit
514c12366b
1 changed files with 33 additions and 0 deletions
|
@ -7,6 +7,8 @@ final class PhutilMercurialBinaryAnalyzer
|
||||||
|
|
||||||
const CAPABILITY_FILES = 'files';
|
const CAPABILITY_FILES = 'files';
|
||||||
const CAPABILITY_INJECTION = 'injection';
|
const CAPABILITY_INJECTION = 'injection';
|
||||||
|
const CAPABILITY_TEMPLATE_PNODE = 'template_pnode';
|
||||||
|
const CAPABILTIY_ANNOTATE_TEMPLATES = 'annotate_templates';
|
||||||
|
|
||||||
protected function newBinaryVersion() {
|
protected function newBinaryVersion() {
|
||||||
$future = id(new ExecFuture('hg --version --quiet'))
|
$future = id(new ExecFuture('hg --version --quiet'))
|
||||||
|
@ -60,6 +62,33 @@ final class PhutilMercurialBinaryAnalyzer
|
||||||
self::CAPABILITY_INJECTION);
|
self::CAPABILITY_INJECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When using `--template` the format for accessing individual parents
|
||||||
|
* changed from `{p1node}` to `{p1.node}` in Mercurial 4.9.
|
||||||
|
*
|
||||||
|
* @return boolean True if the version of Mercurial is new enough to support
|
||||||
|
* the `{p1.node}` format in templates, or false if otherwise.
|
||||||
|
*/
|
||||||
|
public function isMercurialTemplatePnodeAvailable() {
|
||||||
|
return self::versionHasCapability(
|
||||||
|
$this->requireBinaryVersion(),
|
||||||
|
self::CAPABILITY_TEMPLATE_PNODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `hg annotate` command did not accept the `--template` argument until
|
||||||
|
* version 4.6. It appears to function in version 4.5 however it's not
|
||||||
|
* documented and wasn't announced until the 4.6 release.
|
||||||
|
*
|
||||||
|
* @return boolean True if the version of Mercurial is new enough to support
|
||||||
|
* the `--template` option when using `hg annotate`, or false if otherwise.
|
||||||
|
*/
|
||||||
|
public function isMercurialAnnotateTemplatesAvailable() {
|
||||||
|
return self::versionHasCapability(
|
||||||
|
$this->requireBinaryVersion(),
|
||||||
|
self::CAPABILTIY_ANNOTATE_TEMPLATES);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function versionHasCapability(
|
public static function versionHasCapability(
|
||||||
$mercurial_version,
|
$mercurial_version,
|
||||||
|
@ -70,6 +99,10 @@ final class PhutilMercurialBinaryAnalyzer
|
||||||
return version_compare($mercurial_version, '3.2', '>=');
|
return version_compare($mercurial_version, '3.2', '>=');
|
||||||
case self::CAPABILITY_INJECTION:
|
case self::CAPABILITY_INJECTION:
|
||||||
return version_compare($mercurial_version, '3.2.4', '<');
|
return version_compare($mercurial_version, '3.2.4', '<');
|
||||||
|
case self::CAPABILITY_TEMPLATE_PNODE:
|
||||||
|
return version_compare($mercurial_version, '4.9', '>=');
|
||||||
|
case self::CAPABILTIY_ANNOTATE_TEMPLATES:
|
||||||
|
return version_compare($mercurial_version, '4.6', '>=');
|
||||||
default:
|
default:
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
pht(
|
pht(
|
||||||
|
|
Loading…
Reference in a new issue