public function testCommandByVersion() { $cases = array(array('name' => pht('Versions which should not use `files`'), 'versions' => array('2.6.2', '2.9', '3.1'), 'match' => false), array('name' => pht('Versions which should use `files`'), 'versions' => array('3.2', '3.3', '3.5.2'), 'match' => true)); foreach ($cases as $case) { foreach ($case['versions'] as $version) { $actual = PhabricatorRepositoryVersion::isMercurialFilesCommandAvailable($version); $expect = $case['match']; $this->assertEqual($expect, $actual, $case['name']); } } }
protected function executeQuery() { $repository = $this->getRepository(); $path = $this->path; $commit = $this->commit; $hg_paths_command = 'locate --print0 --rev %s -I %s'; $hg_version = PhabricatorRepositoryVersion::getMercurialVersion(); if (PhabricatorRepositoryVersion::isMercurialFilesCommandAvailable($hg_version)) { $hg_paths_command = 'files --print0 --rev %s -I %s'; } $match_against = trim($path, '/'); $prefix = trim('./' . $match_against, '/'); list($entire_manifest) = $repository->execxLocalCommand($hg_paths_command, hgsprintf('%s', $commit), $prefix); return explode("", $entire_manifest); }