mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 16:52:40 +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:
parent
7ae1a0ec40
commit
7a4c97f9c3
1 changed files with 13 additions and 5 deletions
|
@ -336,6 +336,9 @@ EOTEXT
|
||||||
'update' => true,
|
'update' => true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'skip-binaries' => array(
|
||||||
|
'help' => 'Do not upload binaries (like images).',
|
||||||
|
),
|
||||||
'*' => 'paths',
|
'*' => 'paths',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -943,6 +946,10 @@ EOTEXT
|
||||||
'size' => null
|
'size' => null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->getArgument('skip-binaries')) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
$result['size'] = $size = strlen($data);
|
$result['size'] = $size = strlen($data);
|
||||||
if (!$size) {
|
if (!$size) {
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -964,12 +971,13 @@ EOTEXT
|
||||||
));
|
));
|
||||||
|
|
||||||
$result['guid'] = $guid;
|
$result['guid'] = $guid;
|
||||||
} catch (ConduitClientException $e) {
|
} catch (Exception $e) {
|
||||||
$message = "Failed to upload {$desc} '{$name}'. Continue?";
|
echo "Failed to upload {$desc} '{$name}'.\n";
|
||||||
if (!phutil_console_confirm($message, $default_no = false)) {
|
|
||||||
|
if (!phutil_console_confirm('Continue?', $default_no = false)) {
|
||||||
throw new ArcanistUsageException(
|
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;
|
return $result;
|
||||||
|
|
Loading…
Reference in a new issue