Differential D18769 Diff 45040 src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | protected function getMercurialResult(ConduitAPIRequest $request) { | ||||
// NOTE: When viewing the history of a file, we don't use "-b", because | // NOTE: When viewing the history of a file, we don't use "-b", because | ||||
// Mercurial stops history at the branchpoint but we're interested in all | // Mercurial stops history at the branchpoint but we're interested in all | ||||
// ancestors. When viewing history of a branch, we do use "-b", and thus | // ancestors. When viewing history of a branch, we do use "-b", and thus | ||||
// stop history (this is more consistent with the Mercurial worldview of | // stop history (this is more consistent with the Mercurial worldview of | ||||
// branches). | // branches). | ||||
if (strlen($path)) { | if (strlen($path)) { | ||||
$path_arg = csprintf('-- %s', $path); | $path_arg = csprintf('%s', $path); | ||||
$branch_arg = ''; | $revset_arg = hgsprintf( | ||||
'reverse(ancestors(%s))', | |||||
$commit_hash); | |||||
} else { | } else { | ||||
$path_arg = ''; | $path_arg = ''; | ||||
// NOTE: --branch used to be called --only-branch; use -b for | $revset_arg = hgsprintf( | ||||
// compatibility. | 'branch(%s) and reverse(ancestors(%s))', | ||||
$branch_arg = csprintf('-b %s', $drequest->getBranch()); | $drequest->getBranch(), | ||||
$commit_hash); | |||||
} | } | ||||
list($stdout) = $repository->execxLocalCommand( | list($stdout) = $repository->execxLocalCommand( | ||||
'log --debug --template %s --limit %d %C --rev %s %C', | 'log --debug --template %s --limit %d --rev %s -- %C', | ||||
'{node};{parents}\\n', | '{node};{parents}\\n', | ||||
($offset + $limit), // No '--skip' in Mercurial. | ($offset + $limit), // No '--skip' in Mercurial. | ||||
$branch_arg, | $revset_arg, | ||||
hgsprintf('reverse(ancestors(%s))', $commit_hash), | |||||
$path_arg); | $path_arg); | ||||
$stdout = DiffusionMercurialCommandEngine::filterMercurialDebugOutput( | $stdout = DiffusionMercurialCommandEngine::filterMercurialDebugOutput( | ||||
$stdout); | $stdout); | ||||
$lines = explode("\n", trim($stdout)); | $lines = explode("\n", trim($stdout)); | ||||
$lines = array_slice($lines, $offset); | $lines = array_slice($lines, $offset); | ||||
$hash_list = array(); | $hash_list = array(); | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |