mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-11 07:11:03 +01:00
Provide repository API method for getting all files
Test Plan: print_r(iterator_to_array($api->getAllFiles())); // Under Git. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2038 Differential Revision: https://secure.phabricator.com/D3940
This commit is contained in:
parent
827c1bc1c5
commit
d3f351caae
4 changed files with 33 additions and 0 deletions
|
@ -527,6 +527,12 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
return $files;
|
||||
}
|
||||
|
||||
public function getAllFiles() {
|
||||
$future = $this->buildLocalFuture(array('ls-files -z'));
|
||||
return id(new LinesOfALargeExecFuture($future))
|
||||
->setDelimiter("\0");
|
||||
}
|
||||
|
||||
public function getBlame($path) {
|
||||
// TODO: 'git blame' supports --porcelain and we should probably use it.
|
||||
list($stdout) = $this->execxLocal(
|
||||
|
|
|
@ -245,6 +245,12 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
return $this->localCommitInfo;
|
||||
}
|
||||
|
||||
public function getAllFiles() {
|
||||
// TODO: Handle paths with newlines.
|
||||
$future = $this->buildLocalFuture(array('manifest'));
|
||||
return new LinesOfALargeExecFuture($future);
|
||||
}
|
||||
|
||||
public function getBlame($path) {
|
||||
list($stdout) = $this->execxLocal(
|
||||
'annotate -u -v -c --rev %s -- %s',
|
||||
|
|
|
@ -148,6 +148,11 @@ abstract class ArcanistRepositoryAPI {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Traversable
|
||||
*/
|
||||
abstract public function getAllFiles();
|
||||
|
||||
abstract public function getBlame($path);
|
||||
abstract public function getWorkingCopyStatus();
|
||||
abstract public function getRawDiffText($path);
|
||||
|
|
|
@ -465,6 +465,22 @@ Index: {$path}
|
|||
EODIFF;
|
||||
}
|
||||
|
||||
public function getAllFiles() {
|
||||
// TODO: Handle paths with newlines.
|
||||
$future = $this->buildLocalFuture(array('list -R'));
|
||||
return new PhutilCallbackFilterIterator(
|
||||
new LinesOfALargeExecFuture($future),
|
||||
array($this, 'filterFiles'));
|
||||
}
|
||||
|
||||
public function filterFiles($path) {
|
||||
// NOTE: SVN uses '/' also on Windows.
|
||||
if ($path == '' || substr($path, -1) == '/') {
|
||||
return null;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function getBlame($path) {
|
||||
$blame = array();
|
||||
|
||||
|
|
Loading…
Reference in a new issue