Differential D25040 Diff 97 src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | list($stdout) = $repository->execxLocalCommand( | ||||
gitsprintf('%s', $this->identifier)); | gitsprintf('%s', $this->identifier)); | ||||
return preg_split('/\s+/', trim($stdout)); | return preg_split('/\s+/', trim($stdout)); | ||||
} | } | ||||
private function loadMercurialParents() { | private function loadMercurialParents() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$hg_analyzer = PhutilBinaryAnalyzer::getForBinary('hg'); | |||||
if ($hg_analyzer->isMercurialTemplatePnodeAvailable()) { | |||||
$hg_log_template = '{p1.node} {p2.node}'; | |||||
} else { | |||||
$hg_log_template = '{p1node} {p2node}'; | |||||
} | |||||
list($stdout) = $repository->execxLocalCommand( | list($stdout) = $repository->execxLocalCommand( | ||||
'log --debug --limit 1 --template={parents} --rev %s', | 'log --limit 1 --template %s --rev %s', | ||||
$hg_log_template, | |||||
$this->identifier); | $this->identifier); | ||||
$stdout = DiffusionMercurialCommandEngine::filterMercurialDebugOutput( | |||||
$stdout); | |||||
$hashes = preg_split('/\s+/', trim($stdout)); | $hashes = preg_split('/\s+/', trim($stdout)); | ||||
foreach ($hashes as $key => $value) { | foreach ($hashes as $key => $value) { | ||||
// Mercurial parents look like "23:ad9f769d6f786fad9f76d9a" -- we want | // We get 40-character hashes but also get the "000000..." hash for | ||||
// to strip out the local rev part. | // missing parents; ignore it. | ||||
list($local, $global) = explode(':', $value); | if (preg_match('/^0+\z/', $value)) { | ||||
$hashes[$key] = $global; | |||||
// With --debug we get 40-character hashes but also get the "000000..." | |||||
// hash for missing parents; ignore it. | |||||
if (preg_match('/^0+$/', $global)) { | |||||
unset($hashes[$key]); | unset($hashes[$key]); | ||||
} | } | ||||
} | } | ||||
return $hashes; | return $hashes; | ||||
} | } | ||||
private function loadSubversionParents() { | private function loadSubversionParents() { | ||||
Show All 25 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0