Differential D18339 Diff 44158 src/applications/drydock/operation/DrydockLandRepositoryOperation.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/operation/DrydockLandRepositoryOperation.php
| Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | if (!$can_push) { | ||||
| 'title' => pht('Unable to Push'), | 'title' => pht('Unable to Push'), | ||||
| 'body' => pht( | 'body' => pht( | ||||
| 'You do not have permission to push to the repository this '. | 'You do not have permission to push to the repository this '. | ||||
| 'revision is associated with ("%s"), so you can not land it.', | 'revision is associated with ("%s"), so you can not land it.', | ||||
| $repository->getMonogram()), | $repository->getMonogram()), | ||||
| ); | ); | ||||
| } | } | ||||
| $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED; | if ($revision->isAccepted()) { | ||||
| if ($revision->getStatus() != $status_accepted) { | // We can land accepted revisions, so continue below. Otherwise, raise | ||||
| switch ($revision->getStatus()) { | // an error with tailored messaging for the most common cases. | ||||
| case ArcanistDifferentialRevisionStatus::CLOSED: | } else if ($revision->isAbandoned()) { | ||||
| return array( | |||||
| 'title' => pht('Revision Closed'), | |||||
| 'body' => pht( | |||||
| 'This revision has already been closed. Only open, accepted '. | |||||
| 'revisions may land.'), | |||||
| ); | |||||
| case ArcanistDifferentialRevisionStatus::ABANDONED: | |||||
| return array( | return array( | ||||
| 'title' => pht('Revision Abandoned'), | 'title' => pht('Revision Abandoned'), | ||||
| 'body' => pht( | 'body' => pht( | ||||
| 'This revision has been abandoned. Only accepted revisions '. | 'This revision has been abandoned. Only accepted revisions '. | ||||
| 'may land.'), | 'may land.'), | ||||
| ); | ); | ||||
| default: | } else if ($revision->isClosed()) { | ||||
| return array( | |||||
| 'title' => pht('Revision Closed'), | |||||
| 'body' => pht( | |||||
| 'This revision has already been closed. Only open, accepted '. | |||||
| 'revisions may land.'), | |||||
| ); | |||||
| } else { | |||||
| return array( | return array( | ||||
| 'title' => pht('Revision Not Accepted'), | 'title' => pht('Revision Not Accepted'), | ||||
| 'body' => pht( | 'body' => pht( | ||||
| 'This revision is still under review. Only revisions which '. | 'This revision is still under review. Only revisions which '. | ||||
| 'have been accepted may land.'), | 'have been accepted may land.'), | ||||
| ); | ); | ||||
| } | } | ||||
| } | |||||
| // Check for other operations. Eventually this should probably be more | // Check for other operations. Eventually this should probably be more | ||||
| // general (e.g., it's OK to land to multiple different branches | // general (e.g., it's OK to land to multiple different branches | ||||
| // simultaneously) but just put this in as a sanity check for now. | // simultaneously) but just put this in as a sanity check for now. | ||||
| $other_operations = id(new DrydockRepositoryOperationQuery()) | $other_operations = id(new DrydockRepositoryOperationQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withObjectPHIDs(array($revision->getPHID())) | ->withObjectPHIDs(array($revision->getPHID())) | ||||
| ->withOperationTypes( | ->withOperationTypes( | ||||
| ▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines | |||||