1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 23:02:41 +01:00

Recover from all file upload exceptions; add "--skip-binaries" flag

Summary: We recover from Conduit exceptions, but not from transport exceptions or other general classes of error here. Recover from everything, and add an explicit flag to skip uploads.

Test Plan: Added a "throw", created a diff, skiped upload. Removed throw, created a diff with --skip-binaries. Created a diff normally.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2598
This commit is contained in:
epriestley 2012-05-30 14:11:07 -07:00
parent 7ae1a0ec40
commit 7a4c97f9c3

View file

@ -336,6 +336,9 @@ EOTEXT
'update' => true,
),
),
'skip-binaries' => array(
'help' => 'Do not upload binaries (like images).',
),
'*' => 'paths',
);
}
@ -943,6 +946,10 @@ EOTEXT
'size' => null
);
if ($this->getArgument('skip-binaries')) {
return $result;
}
$result['size'] = $size = strlen($data);
if (!$size) {
return $result;
@ -964,12 +971,13 @@ EOTEXT
));
$result['guid'] = $guid;
} catch (ConduitClientException $e) {
$message = "Failed to upload {$desc} '{$name}'. Continue?";
if (!phutil_console_confirm($message, $default_no = false)) {
} catch (Exception $e) {
echo "Failed to upload {$desc} '{$name}'.\n";
if (!phutil_console_confirm('Continue?', $default_no = false)) {
throw new ArcanistUsageException(
'Aborted due to file upload failure.'
);
'Aborted due to file upload failure. You can use --skip-binaries '.
'to skip binary uploads.');
}
}
return $result;