Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15459676
D18418.id44253.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D18418.id44253.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 1, 3:04 PM (4 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384105
Default Alt Text
D18418.id44253.diff (4 KB)
Attached To
Mode
D18418: Migrate revision storage to modern status constants ("accepted") instead of legacy numeric values ("2")
Attached
Detach File
Event Timeline
Log In to Comment