1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 08:42:40 +01:00

Arc diff tries to upload files it knows about using a content hash rather than transfering data.

Summary:
Arc diff will hash file data and try to upload the file using upload by hash rather than transferring data. If it is unable, it defaults to its normal behavior

Attempts to upload file by hash, use regular upload method otherwise

Test Plan: Figure out how to arc diff to my local install and look at the behavior

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, mehrapulkit

Differential Revision: https://secure.phabricator.com/D4968
This commit is contained in:
kwadwo 2013-02-17 14:30:43 -08:00 committed by epriestley
parent aba9d49449
commit 8692587921

View file

@ -1128,7 +1128,6 @@ EOTEXT
list($version, $key) = explode('-', $key, 2); list($version, $key) = explode('-', $key, 2);
$change = $changes[$key]; $change = $changes[$key];
$name = basename($change->getCurrentPath()); $name = basename($change->getCurrentPath());
try { try {
$guid = $future->resolve(); $guid = $future->resolve();
$change->setMetadata($version.':binary-phid', $guid); $change->setMetadata($version.':binary-phid', $guid);
@ -1169,6 +1168,20 @@ EOTEXT
echo "Uploading {$desc} '{$name}' ({$mime_type}, {$size} bytes)...\n"; echo "Uploading {$desc} '{$name}' ({$mime_type}, {$size} bytes)...\n";
// Reuse storage if possible
// Try to upload file using content hash
$contentHash = sha1($data);
$call_result = $this->getConduit()->callMethodSynchronous(
'file.uploadhash',
array(
'hash' => $contentHash,
'name' => $name,
));
if ($call_result) {
$result['future'] = new ImmediateFuture($call_result);
return $result;
}
$result['future'] = $this->getConduit()->callMethod( $result['future'] = $this->getConduit()->callMethod(
'file.upload', 'file.upload',
array( array(