Differential D18306 Diff 44026 src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialPathsQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialPathsQuery.php
| Show All 18 Lines | public function withPath($path) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function executeQuery() { | protected function executeQuery() { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $path = $this->path; | $path = $this->path; | ||||
| $commit = $this->commit; | $commit = $this->commit; | ||||
| $hg_paths_command = 'locate --print0 --rev %s -I %s'; | $has_files = PhutilBinaryAnalyzer::getForBinary('hg') | ||||
| $hg_version = PhabricatorRepositoryVersion::getMercurialVersion(); | ->isMercurialFilesCommandAvailable(); | ||||
| if (PhabricatorRepositoryVersion::isMercurialFilesCommandAvailable( | if ($has_files) { | ||||
| $hg_version)) { | |||||
| $hg_paths_command = 'files --print0 --rev %s -I %s'; | $hg_paths_command = 'files --print0 --rev %s -I %s'; | ||||
| } else { | |||||
| $hg_paths_command = 'locate --print0 --rev %s -I %s'; | |||||
| } | } | ||||
| $match_against = trim($path, '/'); | $match_against = trim($path, '/'); | ||||
| $prefix = trim('./'.$match_against, '/'); | $prefix = trim('./'.$match_against, '/'); | ||||
| list($entire_manifest) = $repository->execxLocalCommand( | list($entire_manifest) = $repository->execxLocalCommand( | ||||
| $hg_paths_command, | $hg_paths_command, | ||||
| hgsprintf('%s', $commit), | hgsprintf('%s', $commit), | ||||
| $prefix); | $prefix); | ||||
| return explode("\0", $entire_manifest); | return explode("\0", $entire_manifest); | ||||
| } | } | ||||
| } | } | ||||