diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 90e2e2ef..23a9df4b 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -307,6 +307,7 @@ phutil_register_library_map(array( 'ArcanistLandCommit' => 'land/ArcanistLandCommit.php', 'ArcanistLandCommitSet' => 'land/ArcanistLandCommitSet.php', 'ArcanistLandEngine' => 'land/engine/ArcanistLandEngine.php', + 'ArcanistLandPushFailureException' => 'land/exception/ArcanistLandPushFailureException.php', 'ArcanistLandSymbol' => 'land/ArcanistLandSymbol.php', 'ArcanistLandTarget' => 'land/ArcanistLandTarget.php', 'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php', @@ -1352,6 +1353,7 @@ phutil_register_library_map(array( 'ArcanistLandCommit' => 'Phobject', 'ArcanistLandCommitSet' => 'Phobject', 'ArcanistLandEngine' => 'ArcanistWorkflowEngine', + 'ArcanistLandPushFailureException' => 'Exception', 'ArcanistLandSymbol' => 'Phobject', 'ArcanistLandTarget' => 'Phobject', 'ArcanistLandWorkflow' => 'ArcanistArcWorkflow', diff --git a/src/land/engine/ArcanistGitLandEngine.php b/src/land/engine/ArcanistGitLandEngine.php index b67d0792..76cce096 100644 --- a/src/land/engine/ArcanistGitLandEngine.php +++ b/src/land/engine/ArcanistGitLandEngine.php @@ -491,7 +491,7 @@ final class ArcanistGitLandEngine $flags_argv, $into_commit); if ($err) { - throw new ArcanistUsageException( + throw new ArcanistLandPushFailureException( pht( 'Submit failed! Fix the error and run "arc land" again.')); } @@ -509,16 +509,10 @@ final class ArcanistGitLandEngine $this->newOntoRefArguments($into_commit)); if ($err) { - throw new ArcanistUsageException( + throw new ArcanistLandPushFailureException( pht( 'Push failed! Fix the error and run "arc land" again.')); } - - // TODO - // if ($this->isGitSvn) { - // $err = phutil_passthru('git svn dcommit'); - // $cmd = 'git svn dcommit'; - } protected function reconcileLocalState( diff --git a/src/land/engine/ArcanistLandEngine.php b/src/land/engine/ArcanistLandEngine.php index a3e36ee7..1bafeb23 100644 --- a/src/land/engine/ArcanistLandEngine.php +++ b/src/land/engine/ArcanistLandEngine.php @@ -1259,7 +1259,7 @@ abstract class ArcanistLandEngine try { $this->pushChange($into_commit); $this->setHasUnpushedChanges(false); - } catch (Exception $ex) { + } catch (ArcanistLandPushFailureException $ex) { // TODO: If the push fails, fetch and retry if the remote ref // has moved ahead of us. @@ -1280,7 +1280,8 @@ abstract class ArcanistLandEngine continue; } - throw $ex; + throw new PhutilArgumentUsageException( + $ex->getMessage()); } if ($need_cascade) { diff --git a/src/land/engine/ArcanistMercurialLandEngine.php b/src/land/engine/ArcanistMercurialLandEngine.php index cbab0033..f737c087 100644 --- a/src/land/engine/ArcanistMercurialLandEngine.php +++ b/src/land/engine/ArcanistMercurialLandEngine.php @@ -836,7 +836,7 @@ final class ArcanistMercurialLandEngine foreach ($body as $command) { $err = $this->newPassthru('%Ls', $command); if ($err) { - throw new ArcanistUsageException( + throw new ArcanistLandPushFailureException( pht( 'Push failed! Fix the error and run "arc land" again.')); } diff --git a/src/land/exception/ArcanistLandPushFailureException.php b/src/land/exception/ArcanistLandPushFailureException.php new file mode 100644 index 00000000..09b1c22a --- /dev/null +++ b/src/land/exception/ArcanistLandPushFailureException.php @@ -0,0 +1,4 @@ +