From 88497bf7dfcd2d58d724dc1f11b98480cdfa005f Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 27 Feb 2013 20:08:44 -0800 Subject: [PATCH] Use reverse(x::y) instead of y::x in Mercurial history queries The revset "x:0" works, but the revset "x::0" is empty. We actually want "reverse(0::x)". Auditors: DurhamGoode --- .../query/history/DiffusionMercurialHistoryQuery.php | 4 ++-- .../lastmodified/DiffusionMercurialLastModifiedQuery.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php b/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php index 244c54f0a1..a72c15192e 100644 --- a/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php +++ b/src/applications/diffusion/query/history/DiffusionMercurialHistoryQuery.php @@ -44,11 +44,11 @@ final class DiffusionMercurialHistoryQuery extends DiffusionHistoryQuery { } list($stdout) = $repository->execxLocalCommand( - 'log --debug --template %s --limit %d %C --rev %s::0 %C', + 'log --debug --template %s --limit %d %C --rev %s %C', '{node};{parents}\\n', ($this->getOffset() + $this->getLimit()), // No '--skip' in Mercurial. $branch_arg, - $commit_hash, + hgsprintf('reverse(%s::%s)', '0', $commit_hash), $path_arg); $lines = explode("\n", trim($stdout)); diff --git a/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php b/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php index 9a8e648e66..e0a40e76c7 100644 --- a/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php +++ b/src/applications/diffusion/query/lastmodified/DiffusionMercurialLastModifiedQuery.php @@ -10,9 +10,9 @@ 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 -- %s', '{node}', - $drequest->getCommit(), + hgsprintf('reverse(%s::%s)', '0', $drequest->getCommit()), nonempty(ltrim($path, '/'), '.')); $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(