mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-24 15:52:40 +01:00
Clean up push failure messaging in "arc land" slightly
Summary: Ref PHI1808. Currently, push failures are messaged awkwardly. Make this exception handling more selective and the user-facing behavior more readable. Test Plan: Ran "arc land" against a failing remote, saw a human-readable message instead of a stack trace. Differential Revision: https://secure.phabricator.com/D21395
This commit is contained in:
parent
710bceab10
commit
3633364bb9
5 changed files with 12 additions and 11 deletions
|
@ -307,6 +307,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistLandCommit' => 'land/ArcanistLandCommit.php',
|
'ArcanistLandCommit' => 'land/ArcanistLandCommit.php',
|
||||||
'ArcanistLandCommitSet' => 'land/ArcanistLandCommitSet.php',
|
'ArcanistLandCommitSet' => 'land/ArcanistLandCommitSet.php',
|
||||||
'ArcanistLandEngine' => 'land/engine/ArcanistLandEngine.php',
|
'ArcanistLandEngine' => 'land/engine/ArcanistLandEngine.php',
|
||||||
|
'ArcanistLandPushFailureException' => 'land/exception/ArcanistLandPushFailureException.php',
|
||||||
'ArcanistLandSymbol' => 'land/ArcanistLandSymbol.php',
|
'ArcanistLandSymbol' => 'land/ArcanistLandSymbol.php',
|
||||||
'ArcanistLandTarget' => 'land/ArcanistLandTarget.php',
|
'ArcanistLandTarget' => 'land/ArcanistLandTarget.php',
|
||||||
'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php',
|
'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php',
|
||||||
|
@ -1352,6 +1353,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistLandCommit' => 'Phobject',
|
'ArcanistLandCommit' => 'Phobject',
|
||||||
'ArcanistLandCommitSet' => 'Phobject',
|
'ArcanistLandCommitSet' => 'Phobject',
|
||||||
'ArcanistLandEngine' => 'ArcanistWorkflowEngine',
|
'ArcanistLandEngine' => 'ArcanistWorkflowEngine',
|
||||||
|
'ArcanistLandPushFailureException' => 'Exception',
|
||||||
'ArcanistLandSymbol' => 'Phobject',
|
'ArcanistLandSymbol' => 'Phobject',
|
||||||
'ArcanistLandTarget' => 'Phobject',
|
'ArcanistLandTarget' => 'Phobject',
|
||||||
'ArcanistLandWorkflow' => 'ArcanistArcWorkflow',
|
'ArcanistLandWorkflow' => 'ArcanistArcWorkflow',
|
||||||
|
|
|
@ -491,7 +491,7 @@ final class ArcanistGitLandEngine
|
||||||
$flags_argv,
|
$flags_argv,
|
||||||
$into_commit);
|
$into_commit);
|
||||||
if ($err) {
|
if ($err) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistLandPushFailureException(
|
||||||
pht(
|
pht(
|
||||||
'Submit failed! Fix the error and run "arc land" again.'));
|
'Submit failed! Fix the error and run "arc land" again.'));
|
||||||
}
|
}
|
||||||
|
@ -509,16 +509,10 @@ final class ArcanistGitLandEngine
|
||||||
$this->newOntoRefArguments($into_commit));
|
$this->newOntoRefArguments($into_commit));
|
||||||
|
|
||||||
if ($err) {
|
if ($err) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistLandPushFailureException(
|
||||||
pht(
|
pht(
|
||||||
'Push failed! Fix the error and run "arc land" again.'));
|
'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(
|
protected function reconcileLocalState(
|
||||||
|
|
|
@ -1259,7 +1259,7 @@ abstract class ArcanistLandEngine
|
||||||
try {
|
try {
|
||||||
$this->pushChange($into_commit);
|
$this->pushChange($into_commit);
|
||||||
$this->setHasUnpushedChanges(false);
|
$this->setHasUnpushedChanges(false);
|
||||||
} catch (Exception $ex) {
|
} catch (ArcanistLandPushFailureException $ex) {
|
||||||
|
|
||||||
// TODO: If the push fails, fetch and retry if the remote ref
|
// TODO: If the push fails, fetch and retry if the remote ref
|
||||||
// has moved ahead of us.
|
// has moved ahead of us.
|
||||||
|
@ -1280,7 +1280,8 @@ abstract class ArcanistLandEngine
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $ex;
|
throw new PhutilArgumentUsageException(
|
||||||
|
$ex->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($need_cascade) {
|
if ($need_cascade) {
|
||||||
|
|
|
@ -836,7 +836,7 @@ final class ArcanistMercurialLandEngine
|
||||||
foreach ($body as $command) {
|
foreach ($body as $command) {
|
||||||
$err = $this->newPassthru('%Ls', $command);
|
$err = $this->newPassthru('%Ls', $command);
|
||||||
if ($err) {
|
if ($err) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistLandPushFailureException(
|
||||||
pht(
|
pht(
|
||||||
'Push failed! Fix the error and run "arc land" again.'));
|
'Push failed! Fix the error and run "arc land" again.'));
|
||||||
}
|
}
|
||||||
|
|
4
src/land/exception/ArcanistLandPushFailureException.php
Normal file
4
src/land/exception/ArcanistLandPushFailureException.php
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ArcanistLandPushFailureException
|
||||||
|
extends Exception {}
|
Loading…
Reference in a new issue