Page MenuHomePhabricator

D18418.id44262.diff
No OneTemporary

D18418.id44262.diff

diff --git a/resources/sql/autopatches/20170811.differential.02.modernstatus.sql b/resources/sql/autopatches/20170811.differential.02.modernstatus.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170811.differential.02.modernstatus.sql
@@ -0,0 +1,17 @@
+UPDATE {$NAMESPACE}_differential.differential_revision
+ SET status = "needs-review" WHERE status = "0";
+
+UPDATE {$NAMESPACE}_differential.differential_revision
+ SET status = "needs-revision" WHERE status = "1";
+
+UPDATE {$NAMESPACE}_differential.differential_revision
+ SET status = "accepted" WHERE status = "2";
+
+UPDATE {$NAMESPACE}_differential.differential_revision
+ SET status = "published" WHERE status = "3";
+
+UPDATE {$NAMESPACE}_differential.differential_revision
+ SET status = "abandoned" WHERE status = "4";
+
+UPDATE {$NAMESPACE}_differential.differential_revision
+ SET status = "changes-planned" WHERE status = "5";
diff --git a/src/applications/differential/constants/DifferentialLegacyQuery.php b/src/applications/differential/constants/DifferentialLegacyQuery.php
--- a/src/applications/differential/constants/DifferentialLegacyQuery.php
+++ b/src/applications/differential/constants/DifferentialLegacyQuery.php
@@ -31,21 +31,6 @@
return $map[$status];
}
- public static function getLegacyValues(array $modern_values) {
- $values = array();
- foreach ($modern_values as $status_constant) {
- $status_object = DifferentialRevisionStatus::newForStatus(
- $status_constant);
-
- $legacy_key = $status_object->getLegacyKey();
- if ($legacy_key !== null) {
- $values[] = $legacy_key;
- }
- }
-
- return $values;
- }
-
private static function getMap() {
$all = array(
DifferentialRevisionStatus::NEEDS_REVIEW,
diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php
--- a/src/applications/differential/query/DifferentialRevisionQuery.php
+++ b/src/applications/differential/query/DifferentialRevisionQuery.php
@@ -695,7 +695,7 @@
$where[] = qsprintf(
$conn_r,
'r.status in (%Ls)',
- DifferentialLegacyQuery::getLegacyValues($this->statuses));
+ $this->statuses);
}
if ($this->isOpen !== null) {
@@ -709,7 +709,7 @@
$where[] = qsprintf(
$conn_r,
'r.status in (%Ls)',
- DifferentialLegacyQuery::getLegacyValues($statuses));
+ $statuses);
}
$where[] = $this->buildWhereClauseParts($conn_r);
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -613,26 +613,15 @@
}
public function setModernRevisionStatus($status) {
- $status_object = DifferentialRevisionStatus::newForStatus($status);
-
- if ($status_object->getKey() != $status) {
- throw new Exception(
- pht(
- 'Trying to set revision to invalid status "%s".',
- $status));
- }
-
- $legacy_status = $status_object->getLegacyKey();
-
- return $this->setStatus($legacy_status);
+ return $this->setStatus($status);
}
public function getModernRevisionStatus() {
- return $this->getStatusObject()->getKey();
+ return $this->getStatus();
}
public function getLegacyRevisionStatus() {
- return $this->getStatus();
+ return $this->getStatusObject()->getLegacyKey();
}
public function isClosed() {
@@ -677,7 +666,7 @@
public function getStatusObject() {
$status = $this->getStatus();
- return DifferentialRevisionStatus::newForLegacyStatus($status);
+ return DifferentialRevisionStatus::newForStatus($status);
}
public function getFlag(PhabricatorUser $viewer) {
diff --git a/src/applications/differential/xaction/DifferentialRevisionStatusTransaction.php b/src/applications/differential/xaction/DifferentialRevisionStatusTransaction.php
--- a/src/applications/differential/xaction/DifferentialRevisionStatusTransaction.php
+++ b/src/applications/differential/xaction/DifferentialRevisionStatusTransaction.php
@@ -14,8 +14,7 @@
}
public function getTitle() {
- $new = $this->getNewValue();
- $status = DifferentialRevisionStatus::newForLegacyStatus($new);
+ $status = $this->newStatusObject();
if ($status->isAccepted()) {
return pht('This revision is now accepted and ready to land.');

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 31, 12:10 AM (5 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384105
Default Alt Text
D18418.id44262.diff (4 KB)

Event Timeline