Page MenuHomePhabricator

D15350.id37012.diff
No OneTemporary

D15350.id37012.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -27,6 +27,7 @@
'AlmanacConduitAPIMethod' => 'applications/almanac/conduit/AlmanacConduitAPIMethod.php',
'AlmanacConsoleController' => 'applications/almanac/controller/AlmanacConsoleController.php',
'AlmanacController' => 'applications/almanac/controller/AlmanacController.php',
+ 'AlmanacCreateClusterServicesCapability' => 'applications/almanac/capability/AlmanacCreateClusterServicesCapability.php',
'AlmanacCreateDevicesCapability' => 'applications/almanac/capability/AlmanacCreateDevicesCapability.php',
'AlmanacCreateNamespacesCapability' => 'applications/almanac/capability/AlmanacCreateNamespacesCapability.php',
'AlmanacCreateNetworksCapability' => 'applications/almanac/capability/AlmanacCreateNetworksCapability.php',
@@ -56,9 +57,10 @@
'AlmanacInterfaceQuery' => 'applications/almanac/query/AlmanacInterfaceQuery.php',
'AlmanacInterfaceTableView' => 'applications/almanac/view/AlmanacInterfaceTableView.php',
'AlmanacKeys' => 'applications/almanac/util/AlmanacKeys.php',
- 'AlmanacManageClusterServicesCapability' => 'applications/almanac/capability/AlmanacManageClusterServicesCapability.php',
+ 'AlmanacManagementLockWorkflow' => 'applications/almanac/management/AlmanacManagementLockWorkflow.php',
'AlmanacManagementRegisterWorkflow' => 'applications/almanac/management/AlmanacManagementRegisterWorkflow.php',
'AlmanacManagementTrustKeyWorkflow' => 'applications/almanac/management/AlmanacManagementTrustKeyWorkflow.php',
+ 'AlmanacManagementUnlockWorkflow' => 'applications/almanac/management/AlmanacManagementUnlockWorkflow.php',
'AlmanacManagementUntrustKeyWorkflow' => 'applications/almanac/management/AlmanacManagementUntrustKeyWorkflow.php',
'AlmanacManagementWorkflow' => 'applications/almanac/management/AlmanacManagementWorkflow.php',
'AlmanacNames' => 'applications/almanac/util/AlmanacNames.php',
@@ -971,6 +973,7 @@
'DrydockWebrootInterface' => 'applications/drydock/interface/webroot/DrydockWebrootInterface.php',
'DrydockWorker' => 'applications/drydock/worker/DrydockWorker.php',
'DrydockWorkingCopyBlueprintImplementation' => 'applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php',
+ 'DrydockCommandError' => 'applications/drydock/DrydockCommandError/DrydockCommandError.php',
'FeedConduitAPIMethod' => 'applications/feed/conduit/FeedConduitAPIMethod.php',
'FeedPublishConduitAPIMethod' => 'applications/feed/conduit/FeedPublishConduitAPIMethod.php',
'FeedPublisherHTTPWorker' => 'applications/feed/worker/FeedPublisherHTTPWorker.php',
@@ -3994,7 +3997,6 @@
'PhabricatorApplicationTransactionInterface',
'AlmanacPropertyInterface',
'PhabricatorDestructibleInterface',
- 'PhabricatorExtendedPolicyInterface',
),
'AlmanacBindingEditController' => 'AlmanacServiceController',
'AlmanacBindingEditor' => 'AlmanacEditor',
@@ -4012,6 +4014,7 @@
'AlmanacConduitAPIMethod' => 'ConduitAPIMethod',
'AlmanacConsoleController' => 'AlmanacController',
'AlmanacController' => 'PhabricatorController',
+ 'AlmanacCreateClusterServicesCapability' => 'PhabricatorPolicyCapability',
'AlmanacCreateDevicesCapability' => 'PhabricatorPolicyCapability',
'AlmanacCreateNamespacesCapability' => 'PhabricatorPolicyCapability',
'AlmanacCreateNetworksCapability' => 'PhabricatorPolicyCapability',
@@ -4028,7 +4031,6 @@
'PhabricatorDestructibleInterface',
'PhabricatorNgramsInterface',
'PhabricatorConduitResultInterface',
- 'PhabricatorExtendedPolicyInterface',
),
'AlmanacDeviceController' => 'AlmanacController',
'AlmanacDeviceEditController' => 'AlmanacDeviceController',
@@ -4056,9 +4058,10 @@
'AlmanacInterfaceQuery' => 'AlmanacQuery',
'AlmanacInterfaceTableView' => 'AphrontView',
'AlmanacKeys' => 'Phobject',
- 'AlmanacManageClusterServicesCapability' => 'PhabricatorPolicyCapability',
+ 'AlmanacManagementLockWorkflow' => 'AlmanacManagementWorkflow',
'AlmanacManagementRegisterWorkflow' => 'AlmanacManagementWorkflow',
'AlmanacManagementTrustKeyWorkflow' => 'AlmanacManagementWorkflow',
+ 'AlmanacManagementUnlockWorkflow' => 'AlmanacManagementWorkflow',
'AlmanacManagementUntrustKeyWorkflow' => 'AlmanacManagementWorkflow',
'AlmanacManagementWorkflow' => 'PhabricatorManagementWorkflow',
'AlmanacNames' => 'Phobject',
@@ -4128,7 +4131,6 @@
'PhabricatorDestructibleInterface',
'PhabricatorNgramsInterface',
'PhabricatorConduitResultInterface',
- 'PhabricatorExtendedPolicyInterface',
),
'AlmanacServiceController' => 'AlmanacController',
'AlmanacServiceDatasource' => 'PhabricatorTypeaheadDatasource',
diff --git a/src/applications/drydock/DrydockCommandError/DrydockCommandError.php b/src/applications/drydock/DrydockCommandError/DrydockCommandError.php
new file mode 100644
--- /dev/null
+++ b/src/applications/drydock/DrydockCommandError/DrydockCommandError.php
@@ -0,0 +1,18 @@
+<?php
+
+class DrydockCommandError {
+ public static function newFromCommandException(
+ $phase,
+ $command,
+ CommandException $ex) {
+ $error = array(
+ 'phase' => $phase,
+ 'command' => (string)$command,
+ 'raw' => (string)$ex->getCommand(),
+ 'err' => $ex->getError(),
+ 'stdout' => $ex->getStdout(),
+ 'stderr' => $ex->getStderr(),
+ );
+ return $error;
+ }
+}
diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
@@ -448,35 +448,17 @@
try {
$interface->execx('%C', $real_command);
} catch (CommandException $ex) {
- $this->setWorkingCopyVCSErrorFromCommandException(
- $lease,
+ $error = DrydockCommandError::newFromCommandException(
self::PHASE_SQUASHMERGE,
$show_command,
$ex);
+ $lease->setAttribute('workingcopy.vcs.error', $error);
throw $ex;
}
}
- protected function setWorkingCopyVCSErrorFromCommandException(
- DrydockLease $lease,
- $phase,
- $command,
- CommandException $ex) {
-
- $error = array(
- 'phase' => $phase,
- 'command' => (string)$command,
- 'raw' => (string)$ex->getCommand(),
- 'err' => $ex->getError(),
- 'stdout' => $ex->getStdout(),
- 'stderr' => $ex->getStderr(),
- );
-
- $lease->setAttribute('workingcopy.vcs.error', $error);
- }
-
- public function getWorkingCopyVCSError(DrydockLease $lease) {
+ public function getCommandError(DrydockLease $lease) {
$error = $lease->getAttribute('workingcopy.vcs.error');
if (!$error) {
return null;
diff --git a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
--- a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
+++ b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
@@ -4,6 +4,7 @@
extends DrydockRepositoryOperationType {
const OPCONST = 'land';
+ const PHASE_PUSH = 'push';
public function getOperationDescription(
DrydockRepositoryOperation $operation,
@@ -122,10 +123,23 @@
->write($commit_message)
->resolvex();
- $interface->execx(
+ try {
+ $interface->execx(
+ 'git push origin -- %s:%s',
+ 'HEAD',
+ $push_dst);
+ } catch (CommandException $ex) {
+ $show_command = csprintf(
'git push origin -- %s:%s',
'HEAD',
$push_dst);
+ $error = DrydockCommandError::newFromCommandException(
+ self::PHASE_PUSH,
+ $show_command,
+ $ex);
+ $operation->setCommandError($error);
+ throw $ex;
+ }
}
private function getCommitterInfo(DrydockRepositoryOperation $operation) {
diff --git a/src/applications/drydock/storage/DrydockRepositoryOperation.php b/src/applications/drydock/storage/DrydockRepositoryOperation.php
--- a/src/applications/drydock/storage/DrydockRepositoryOperation.php
+++ b/src/applications/drydock/storage/DrydockRepositoryOperation.php
@@ -178,11 +178,11 @@
return $this->getProperty('exec.leasePHID');
}
- public function setWorkingCopyVCSError(array $error) {
+ public function setCommandError(array $error) {
return $this->setProperty('exec.workingcopy.error', $error);
}
- public function getWorkingCopyVCSError() {
+ public function getCommandError() {
return $this->getProperty('exec.workingcopy.error');
}
diff --git a/src/applications/drydock/view/DrydockRepositoryOperationStatusView.php b/src/applications/drydock/view/DrydockRepositoryOperationStatusView.php
--- a/src/applications/drydock/view/DrydockRepositoryOperationStatusView.php
+++ b/src/applications/drydock/view/DrydockRepositoryOperationStatusView.php
@@ -74,7 +74,7 @@
if ($state != DrydockRepositoryOperation::STATE_FAIL) {
$item->addAttribute($operation->getOperationCurrentStatus($viewer));
} else {
- $vcs_error = $operation->getWorkingCopyVCSError();
+ $vcs_error = $operation->getCommandError();
if ($vcs_error) {
switch ($vcs_error['phase']) {
case DrydockWorkingCopyBlueprintImplementation::PHASE_SQUASHMERGE:
@@ -82,6 +82,12 @@
'This change did not merge cleanly. This usually indicates '.
'that the change is out of date and needs to be updated.');
break;
+ case DrydockLandRepositoryOperation::PHASE_PUSH:
+ $message = pht(
+ 'The push failed. This usually indicates '.
+ 'that the change is breaking some rules or '.
+ 'some custome git commit hooks fail.');
+ break;
default:
$message = pht(
'Operation encountered an error while performing repository '.
diff --git a/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php b/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php
--- a/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php
+++ b/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php
@@ -138,10 +138,10 @@
}
if (!$lease->isActive()) {
- $vcs_error = $working_copy->getWorkingCopyVCSError($lease);
+ $vcs_error = $working_copy->getCommandError($lease);
if ($vcs_error) {
$operation
- ->setWorkingCopyVCSError($vcs_error)
+ ->setCommandError($vcs_error)
->save();
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 3:23 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6910944
Default Alt Text
D15350.id37012.diff (10 KB)

Event Timeline