From: epriestley Date: Wed, 30 May 2012 21:11:07 +0000 (-0700) Subject: Recover from all file upload exceptions; add "--skip-binaries" flag X-Git-Tag: conduit-6~292 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=7a4c97f9c306670b8dc9b18c1890b56fb1b931f7;p=arcanist.git 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 --- diff --git a/src/workflow/diff/ArcanistDiffWorkflow.php b/src/workflow/diff/ArcanistDiffWorkflow.php index 18498c3c..5aef34ff 100644 --- a/src/workflow/diff/ArcanistDiffWorkflow.php +++ b/src/workflow/diff/ArcanistDiffWorkflow.php @@ -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;