]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Recover from all file upload exceptions; add "--skip-binaries" flag
authorepriestley <git@epriestley.com>
Wed, 30 May 2012 21:11:07 +0000 (14:11 -0700)
committerepriestley <git@epriestley.com>
Wed, 30 May 2012 21:11:07 +0000 (14:11 -0700)
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

src/workflow/diff/ArcanistDiffWorkflow.php

index 18498c3cdd2105ee44c4b2430e4f5c4188281f6c..5aef34ffd8b7d07856f5fd4a57aab1531eff5884 100644 (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;