From 59cd94d8ebca57999b18d954bbfbbc2b0e0a0268 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 1 Nov 2011 17:21:39 -0700 Subject: [PATCH] Correctly implement getFileDataAtRevision() Summary: Apparently I just never tested this or something. Make it work correctly. Test Plan: Ran "arc diff" in a Mercurial working copy with a binary file in outgoing. Reviewers: Makinde Reviewed By: Makinde CC: aran, Makinde Differential Revision: 1074 --- src/repository/api/mercurial/ArcanistMercurialAPI.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/repository/api/mercurial/ArcanistMercurialAPI.php b/src/repository/api/mercurial/ArcanistMercurialAPI.php index 0dc251f1..fe771736 100644 --- a/src/repository/api/mercurial/ArcanistMercurialAPI.php +++ b/src/repository/api/mercurial/ArcanistMercurialAPI.php @@ -269,11 +269,17 @@ class ArcanistMercurialAPI extends ArcanistRepositoryAPI { } private function getFileDataAtRevision($path, $revision) { - list($stdout) = execx( + list($err, $stdout) = exec_manual( '(cd %s && hg cat --rev %s -- %s)', $this->getPath(), + $revision, $path); - return $stdout; + if ($err) { + // Assume this is "no file at revision", i.e. a deleted or added file. + return null; + } else { + return $stdout; + } } private function getWorkingCopyRevision() { -- 2.43.0