From 5068e8ad560ac897c554552ef3522cd28d45d0b5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 9 Apr 2012 17:34:45 -0700 Subject: [PATCH] Provide a "loadFileDataCallback" for ArcanistBundle 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/parser/bundle/ArcanistBundle.php b/src/parser/bundle/ArcanistBundle.php index f96c8d0c..dec839c4 100644 --- a/src/parser/bundle/ArcanistBundle.php +++ b/src/parser/bundle/ArcanistBundle.php @@ -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) {