1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Remove hgsprintf() from arcanist

Summary: Moving to libphutil.

Test Plan: unit

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D5058
This commit is contained in:
epriestley 2013-02-21 16:44:19 -08:00
parent 7a415e7e0c
commit 3e3ea378ed
3 changed files with 1 additions and 67 deletions

View file

@ -115,7 +115,6 @@ phutil_register_library_map(array(
'ArcanistPhutilXHPASTLinterTestCase' => 'lint/linter/__tests__/ArcanistPhutilXHPASTLinterTestCase.php',
'ArcanistPyFlakesLinter' => 'lint/linter/ArcanistPyFlakesLinter.php',
'ArcanistPyLintLinter' => 'lint/linter/ArcanistPyLintLinter.php',
'ArcanistRepoUtilsTestCase' => 'repository/util/__tests__/ArcanistRepoUtilsTestCase.php',
'ArcanistRepositoryAPI' => 'repository/api/ArcanistRepositoryAPI.php',
'ArcanistRepositoryAPIMiscTestCase' => 'repository/api/__tests__/ArcanistRepositoryAPIMiscTestCase.php',
'ArcanistRepositoryAPIStateTestCase' => 'repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php',
@ -167,8 +166,6 @@ phutil_register_library_map(array(
),
'function' =>
array(
'hgsprintf' => 'repository/util/hgsprintf.php',
'xsprintf_mercurial' => 'repository/util/hgsprintf.php',
),
'xmap' =>
array(
@ -179,7 +176,7 @@ phutil_register_library_map(array(
'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
'ArcanistBaseWorkflow' => 'Phobject',
'ArcanistBaseXHPASTLinter' => 'ArcanistLinter',
'ArcanistBaseXHPASTLinter' => 'ArcanistFutureLinter',
'ArcanistBookmarkWorkflow' => 'ArcanistFeatureWorkflow',
'ArcanistBranchWorkflow' => 'ArcanistFeatureWorkflow',
'ArcanistBritishTestCase' => 'ArcanistTestCase',
@ -251,7 +248,6 @@ phutil_register_library_map(array(
'ArcanistPhutilXHPASTLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
'ArcanistPyLintLinter' => 'ArcanistLinter',
'ArcanistRepoUtilsTestCase' => 'ArcanistTestCase',
'ArcanistRepositoryAPIMiscTestCase' => 'ArcanistTestCase',
'ArcanistRepositoryAPIStateTestCase' => 'ArcanistTestCase',
'ArcanistRubyLinter' => 'ArcanistLinter',

View file

@ -1,23 +0,0 @@
<?php
final class ArcanistRepoUtilsTestCase extends ArcanistTestCase {
public function testhgsprintf() {
$this->assertEqual(
"'version-1'",
hgsprintf('%s', 'version-1'));
$this->assertEqual(
"'single\\'quote'",
hgsprintf('%s', "single'quote"));
$this->assertEqual(
"'back\\\\slash'",
hgsprintf('%s', 'back\\slash'));
$this->assertEqual(
"'33%'",
hgsprintf('%R', hgsprintf('%s', '33%')));
}
}

View file

@ -1,39 +0,0 @@
<?php
/**
* Format a Mercurial revset expression. Supports the following conversions:
*
* %s Symbol
* Escapes a Mercurial symbol, like a branch or bookmark name.
*
* %R Rrraw Rreferrrence / Rrrrevset
* Passes text through unescaped (e.g., an already-escaped revset).
*
* @group mercurial
*/
function hgsprintf($pattern /* , ... */) {
$args = func_get_args();
return xsprintf('xsprintf_mercurial', null, $args);
}
/**
* xsprintf() callback for Mercurial encoding.
*
* @group mercurial
*/
function xsprintf_mercurial($userdata, &$pattern, &$pos, &$value, &$length) {
$type = $pattern[$pos];
switch ($type) {
case 's':
$value = "'".addcslashes($value, "'\\")."'";
break;
case 'R':
$type = 's';
break;
}
$pattern[$pos] = $type;
}