diff --git a/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php b/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php index 5377e820f9..244c54f0a1 100644 --- a/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php +++ b/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php @@ -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); diff --git a/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php b/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php index 5a5f686351..9a8e648e66 100644 --- a/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php +++ b/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php @@ -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, '/'), '.'));