1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 15:00:58 +01:00

Merge pull request #62 from abdul/master

Differential Revision: D909
This commit is contained in:
Evan Priestley 2011-09-08 13:56:12 -07:00
commit 206546a6e3
9 changed files with 32 additions and 22 deletions

View file

@ -140,9 +140,9 @@ final class DiffusionSvnDiffQuery extends DiffusionDiffQuery {
$repository = $drequest->getRepository();
list($ref, $rev) = $spec;
return new ExecFuture(
'svn --non-interactive cat %s%s@%d',
$repository->getDetail('remote-uri'),
return $repository->getRemoteCommandFuture(
'cat %s%s@%d',
$repository->getRemoteURI(),
$ref,
$rev);
}

View file

@ -16,7 +16,6 @@ phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/ba
phutil_require_module('phabricator', 'infrastructure/diff/engine');
phutil_require_module('phutil', 'future');
phutil_require_module('phutil', 'future/exec');
phutil_require_module('phutil', 'utils');

View file

@ -33,11 +33,11 @@ final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery {
$path = $drequest->getPath();
$commit = $drequest->getCommit();
$remote_uri = $repository->getDetail('remote-uri');
$remote_uri = $repository->getRemoteURI();
try {
list($corpus) = execx(
'svn --non-interactive %s %s%s@%s',
list($corpus) = $repository->execxRemoteCommand(
'%s %s%s@%s',
$this->getNeedsBlame() ? 'blame' : 'cat',
$remote_uri,
$path,

View file

@ -9,7 +9,6 @@
phutil_require_module('phabricator', 'applications/diffusion/data/filecontent');
phutil_require_module('phabricator', 'applications/diffusion/query/filecontent/base');
phutil_require_module('phutil', 'future/exec');
phutil_require_module('phutil', 'utils');

View file

@ -28,9 +28,9 @@ class PhabricatorRepositorySvnCommitDiscoveryDaemon
}
$uri = $this->getBaseSVNLogURI();
list($xml) = execx(
'svn log --xml --non-interactive --quiet --limit 1 %s@HEAD',
$uri);
list($xml) = $repository->execxRemoteCommand(
' log --xml --quiet --limit 1 %s@HEAD',
$uri);
$results = $this->parseSVNLogXML($xml);
$commit = key($results);
@ -47,6 +47,7 @@ class PhabricatorRepositorySvnCommitDiscoveryDaemon
private function discoverCommit($commit, $epoch) {
$uri = $this->getBaseSVNLogURI();
$repository = $this->getRepository();
$discover = array(
$commit => $epoch,
@ -58,8 +59,8 @@ class PhabricatorRepositorySvnCommitDiscoveryDaemon
// Find all the unknown commits on this path. Note that we permit
// importing an SVN subdirectory rather than the entire repository, so
// commits may be nonsequential.
list($err, $xml, $stderr) = exec_manual(
'svn log --xml --non-interactive --quiet --limit %d %s@%d',
list($err, $xml, $stderr) = $repository->execRemoteCommand(
' log --xml --quiet --limit %d %s@%d',
$limit,
$uri,
$upper_bound - 1);

View file

@ -9,7 +9,6 @@
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
phutil_require_module('phabricator', 'applications/repository/daemon/commitdiscovery/base');
phutil_require_module('phutil', 'future/exec');
phutil_require_module('phutil', 'utils');

View file

@ -97,6 +97,12 @@ class PhabricatorRepository extends PhabricatorRepositoryDAO {
return call_user_func_array('execx', $args);
}
public function getRemoteCommandFuture($pattern /*, $arg, ... */) {
$args = func_get_args();
$args = $this->formatRemoteCommand($args);
return newv('ExecFuture', $args);
}
public function passthruRemoteCommand($pattern /*, $arg, ... */) {
$args = func_get_args();
$args = $this->formatRemoteCommand($args);
@ -115,12 +121,19 @@ class PhabricatorRepository extends PhabricatorRepositoryDAO {
return call_user_func_array('execx', $args);
}
public function getLocalCommandFuture($pattern /*, $arg, ... */) {
$args = func_get_args();
$args = $this->formatLocalCommand($args);
return newv('ExecFuture', $args);
}
public function passthruLocalCommand($pattern /*, $arg, ... */) {
$args = func_get_args();
$args = $this->formatLocalCommand($args);
return call_user_func_array('phutil_passthru', $args);
}
private function formatRemoteCommand(array $args) {
$pattern = $args[0];
$args = array_slice($args, 1);

View file

@ -68,8 +68,8 @@ abstract class PhabricatorRepositoryCommitParserWorker
}
try {
list($xml) = execx(
"svn log --xml {$verbose} --limit 1 --non-interactive %s@%d",
list($xml) = $this->repository->execxRemoteCommand(
"log --xml {$verbose} --limit 1 %s@%d",
$uri,
$revision);
} catch (CommandException $ex) {

View file

@ -593,10 +593,9 @@ class PhabricatorRepositorySvnCommitChangeParserWorker
// position in the document.
$all_paths = array_reverse(array_keys($parents));
foreach (array_chunk($all_paths, 64) as $path_chunk) {
list($raw_xml) = execx(
'svn --non-interactive --xml ls %C',
implode(' ', $path_chunk));
list($raw_xml) = $repository->execxRemoteCommand(
'--xml ls %C',
implode(' ', $path_chunk));
$xml = new SimpleXMLElement($raw_xml);
foreach ($xml->list as $list) {
$list_path = (string)$list['path'];
@ -669,8 +668,8 @@ class PhabricatorRepositorySvnCommitChangeParserWorker
$cache_loc = sys_get_temp_dir().'/diffusion.'.$hashkey.'.svnls';
if (!Filesystem::pathExists($cache_loc)) {
$tmp = new TempFile();
execx(
'svn --non-interactive --xml ls -R %s%s@%d > %s',
$repository->execxRemoteCommand(
'--xml ls -R %s%s@%d > %s',
$repository->getDetail('remote-uri'),
$path,
$rev,