1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-20 18:58:56 +01:00

Fix DiffusionMercurialHistoryQuery for file history

Summary: When querying history of a path, we should continue past branchpoints. See D5146 for more discussion.

Test Plan:
Viewing history of a file on a branch which never modified the file no longer fatals.

(Arguably we could render something like "this file was never modified on this branch" and maybe link to the branch where the branchpoint stems from, but that seems of limited use.)

Reviewers: DurhamGoode, vrana, chad

Reviewed By: DurhamGoode

CC: aran

Differential Revision: https://secure.phabricator.com/D5148
This commit is contained in:
epriestley 2013-02-27 19:17:26 -08:00
parent e5122877a5
commit e2c9ebdbc1
2 changed files with 15 additions and 5 deletions

View file

@ -27,17 +27,27 @@ final class DiffusionMercurialHistoryQuery extends DiffusionHistoryQuery {
// If we don't have a path component in the query, omit it from the command
// entirely to avoid these inconsistencies.
$path_arg = '';
// 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
// ancestors. When viewing history of a branch, we do use "-b", and thus
// stop history (this is more consistent with the Mercurial worldview of
// branches).
if (strlen($path)) {
$path_arg = csprintf('-- %s', $path);
$branch_arg = '';
} else {
$path_arg = '';
// NOTE: --branch used to be called --only-branch; use -b for
// compatibility.
$branch_arg = csprintf('-b %s', $drequest->getBranch());
}
// NOTE: --branch used to be called --only-branch; use -b for compatibility.
list($stdout) = $repository->execxLocalCommand(
'log --debug --template %s --limit %d -b %s --rev %s:0 %C',
'log --debug --template %s --limit %d %C --rev %s::0 %C',
'{node};{parents}\\n',
($this->getOffset() + $this->getLimit()), // No '--skip' in Mercurial.
$drequest->getBranch(),
$branch_arg,
$commit_hash,
$path_arg);

View file

@ -10,7 +10,7 @@ final class DiffusionMercurialLastModifiedQuery
$path = $drequest->getPath();
list($hash) = $repository->execxLocalCommand(
'log --template %s --limit 1 --rev %s:0 -- %s',
'log --template %s --limit 1 --rev %s::0 -- %s',
'{node}',
$drequest->getCommit(),
nonempty(ltrim($path, '/'), '.'));