mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
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
This commit is contained in:
parent
f3fc75fcb9
commit
5068e8ad56
1 changed files with 11 additions and 1 deletions
|
@ -31,6 +31,7 @@ final class ArcanistBundle {
|
||||||
private $baseRevision;
|
private $baseRevision;
|
||||||
private $revisionID;
|
private $revisionID;
|
||||||
private $encoding;
|
private $encoding;
|
||||||
|
private $loadFileDataCallback;
|
||||||
|
|
||||||
public function setConduit(ConduitClient $conduit) {
|
public function setConduit(ConduitClient $conduit) {
|
||||||
$this->conduit = $conduit;
|
$this->conduit = $conduit;
|
||||||
|
@ -583,7 +584,16 @@ final class ArcanistBundle {
|
||||||
return implode("\n", $result);
|
return implode("\n", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setLoadFileDataCallback($callback) {
|
||||||
|
$this->loadFileDataCallback = $callback;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
private function getBlob($phid) {
|
private function getBlob($phid) {
|
||||||
|
if ($this->loadFileDataCallback) {
|
||||||
|
return call_user_func($this->loadFileDataCallback, $phid);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->diskPath) {
|
if ($this->diskPath) {
|
||||||
list($blob_data) = execx('tar xfO %s blobs/%s', $this->diskPath, $phid);
|
list($blob_data) = execx('tar xfO %s blobs/%s', $this->diskPath, $phid);
|
||||||
return $blob_data;
|
return $blob_data;
|
||||||
|
@ -599,7 +609,7 @@ final class ArcanistBundle {
|
||||||
return base64_decode($data_base64);
|
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) {
|
private function buildBinaryChange(ArcanistDiffChange $change) {
|
||||||
|
|
Loading…
Reference in a new issue