]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Correctly implement getFileDataAtRevision()
authorepriestley <git@epriestley.com>
Wed, 2 Nov 2011 00:21:39 +0000 (17:21 -0700)
committerepriestley <git@epriestley.com>
Wed, 2 Nov 2011 00:28:02 +0000 (17:28 -0700)
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

index 0dc251f1557c637c57611851e03c52dbdb3aac34..fe771736daf34422cab93bf74c54ffe624312a39 100644 (file)
@@ -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() {