Page MenuHomePhabricator

D12167.id29241.diff
No OneTemporary

D12167.id29241.diff

diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php
--- a/src/applications/differential/controller/DifferentialDiffViewController.php
+++ b/src/applications/differential/controller/DifferentialDiffViewController.php
@@ -38,19 +38,10 @@
pht('Create a new Revision...'));
$select[] = hsprintf('</optgroup>');
- $revisions = id(new DifferentialRevisionQuery())
- ->setViewer($viewer)
- ->withAuthors(array($viewer->getPHID()))
- ->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
- ->requireCapabilities(
- array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- ))
- ->execute();
-
$selected_id = $request->getInt('revisionID');
+ $revisions = $this->loadSelectableRevisions($viewer, $selected_id);
+
if ($revisions) {
$select[] = hsprintf(
'<optgroup label="%s">',
@@ -153,4 +144,45 @@
));
}
+ private function loadSelectableRevisions(
+ PhabricatorUser $viewer,
+ $selected_id) {
+
+ $revisions = id(new DifferentialRevisionQuery())
+ ->setViewer($viewer)
+ ->withAuthors(array($viewer->getPHID()))
+ ->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->execute();
+ $revisions = mpull($revisions, null, 'getID');
+
+ // If a specific revision is selected (for example, because the user is
+ // following the "Update Diff" workflow), but not present in the dropdown,
+ // try to add it to the dropdown even if it is closed. This allows the
+ // workflow to be used to update abandoned revisions.
+
+ if ($selected_id) {
+ if (empty($revisions[$selected_id])) {
+ $selected = id(new DifferentialRevisionQuery())
+ ->setViewer($viewer)
+ ->withAuthors(array($viewer->getPHID()))
+ ->withIDs(array($selected_id))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->execute();
+ $revisions = mpull($selected, null, 'getID') + $revisions;
+ }
+ }
+
+ return $revisions;
+ }
+
+
}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -187,6 +187,7 @@
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
$status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
+ $status_abandoned = ArcanistDifferentialRevisionStatus::ABANDONED;
switch ($xaction->getTransactionType()) {
case PhabricatorTransactions::TYPE_VIEW_POLICY:
@@ -202,10 +203,14 @@
case PhabricatorTransactions::TYPE_EDGE:
return;
case DifferentialTransaction::TYPE_UPDATE:
- if (!$this->getIsCloseByCommit() &&
- (($object->getStatus() == $status_revision) ||
- ($object->getStatus() == $status_plan))) {
- $object->setStatus($status_review);
+ if (!$this->getIsCloseByCommit()) {
+ switch ($object->getStatus()) {
+ case $status_revision:
+ case $status_plan:
+ case $status_abandoned:
+ $object->setStatus($status_review);
+ break;
+ }
}
$diff = $this->requireDiff($xaction->getNewValue());

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 12:30 AM (1 h, 34 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6924165
Default Alt Text
D12167.id29241.diff (3 KB)

Event Timeline