]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Provide a "loadFileDataCallback" for ArcanistBundle
authorepriestley <git@epriestley.com>
Tue, 10 Apr 2012 00:34:45 +0000 (17:34 -0700)
committerepriestley <git@epriestley.com>
Tue, 10 Apr 2012 00:34:45 +0000 (17:34 -0700)
Summary: See next diff for an explanation of this issue.

Test Plan: See next diff.

Reviewers: Makinde, btrahan, vrana, jungejason

Reviewed By: Makinde

CC: aran
Differential Revision: https://secure.phabricator.com/D2174

src/parser/bundle/ArcanistBundle.php

index f96c8d0c9d53a3d53ea06c500344f07b4f863f19..dec839c457ba3ec893659245e290b663b2acf710 100644 (file)
@@ -31,6 +31,7 @@ final class ArcanistBundle {
   private $baseRevision;
   private $revisionID;
   private $encoding;
+  private $loadFileDataCallback;
 
   public function setConduit(ConduitClient $conduit) {
     $this->conduit = $conduit;
@@ -583,7 +584,16 @@ final class ArcanistBundle {
     return implode("\n", $result);
   }
 
+  public function setLoadFileDataCallback($callback) {
+    $this->loadFileDataCallback = $callback;
+    return $this;
+  }
+
   private function getBlob($phid) {
+    if ($this->loadFileDataCallback) {
+      return call_user_func($this->loadFileDataCallback, $phid);
+    }
+
     if ($this->diskPath) {
       list($blob_data) = execx('tar xfO %s blobs/%s', $this->diskPath, $phid);
       return $blob_data;
@@ -599,7 +609,7 @@ final class ArcanistBundle {
       return base64_decode($data_base64);
     }
 
-    throw new Exception("Nowhere to load blob '{$phid} from!");
+    throw new Exception("Nowhere to load blob '{$phid}' from!");
   }
 
   private function buildBinaryChange(ArcanistDiffChange $change) {