Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F85452
D7653.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D7653.diff
View Options
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
@@ -68,8 +68,7 @@
->execute();
if ($parent_rev) {
$parent_rev = head($parent_rev);
- if ($parent_rev->getStatus() !=
- ArcanistDifferentialRevisionStatus::CLOSED) {
+ if (!$parent_rev->isClosed()) {
$diff->setParentRevisionID($parent_id);
}
}
diff --git a/src/applications/differential/constants/DifferentialRevisionStatus.php b/src/applications/differential/constants/DifferentialRevisionStatus.php
--- a/src/applications/differential/constants/DifferentialRevisionStatus.php
+++ b/src/applications/differential/constants/DifferentialRevisionStatus.php
@@ -70,4 +70,30 @@
return $tag;
}
+
+ public static function getClosedStatuses() {
+ return array(
+ ArcanistDifferentialRevisionStatus::CLOSED,
+ ArcanistDifferentialRevisionStatus::ABANDONED,
+ );
+ }
+
+ public static function getOpenStatuses() {
+ return array_diff(self::getAllStatuses(), self::getClosedStatuses());
+ }
+
+ public static function getAllStatuses() {
+ return array(
+ ArcanistDifferentialRevisionStatus::NEEDS_REVIEW,
+ ArcanistDifferentialRevisionStatus::NEEDS_REVISION,
+ ArcanistDifferentialRevisionStatus::ACCEPTED,
+ ArcanistDifferentialRevisionStatus::CLOSED,
+ ArcanistDifferentialRevisionStatus::ABANDONED,
+ );
+ }
+
+ public static function isClosedStatus($status) {
+ return in_array($status, self::getClosedStatuses());
+ }
+
}
diff --git a/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php b/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
--- a/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
+++ b/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
@@ -78,13 +78,7 @@
}
public function isObjectClosed($object) {
- switch ($object->getStatus()) {
- case ArcanistDifferentialRevisionStatus::CLOSED:
- case ArcanistDifferentialRevisionStatus::ABANDONED:
- return true;
- default:
- return false;
- }
+ return $object->isClosed();
}
public function getResponsibilityTitle($object) {
diff --git a/src/applications/differential/phid/DifferentialPHIDTypeRevision.php b/src/applications/differential/phid/DifferentialPHIDTypeRevision.php
--- a/src/applications/differential/phid/DifferentialPHIDTypeRevision.php
+++ b/src/applications/differential/phid/DifferentialPHIDTypeRevision.php
@@ -29,11 +29,6 @@
array $handles,
array $objects) {
- static $closed_statuses = array(
- ArcanistDifferentialRevisionStatus::CLOSED => true,
- ArcanistDifferentialRevisionStatus::ABANDONED => true,
- );
-
foreach ($handles as $phid => $handle) {
$revision = $objects[$phid];
@@ -45,7 +40,7 @@
$handle->setURI("/D{$id}");
$handle->setFullName("D{$id}: {$title}");
- if (isset($closed_statuses[$status])) {
+ if ($revision->isClosed()) {
$handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED);
}
}
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
@@ -23,8 +23,7 @@
const STATUS_ACCEPTED = 'status-accepted';
const STATUS_NEEDS_REVIEW = 'status-needs-review';
const STATUS_NEEDS_REVISION = 'status-needs-revision';
- const STATUS_CLOSED = 'status-closed'; // NOTE: Same as 'committed'
- const STATUS_COMMITTED = 'status-committed'; // TODO: Remove.
+ const STATUS_CLOSED = 'status-closed';
const STATUS_ABANDONED = 'status-abandoned';
private $authors = array();
@@ -772,11 +771,7 @@
$where[] = qsprintf(
$conn_r,
'r.status IN (%Ld)',
- array(
- ArcanistDifferentialRevisionStatus::NEEDS_REVIEW,
- ArcanistDifferentialRevisionStatus::NEEDS_REVISION,
- ArcanistDifferentialRevisionStatus::ACCEPTED,
- ));
+ DifferentialRevisionStatus::getOpenStatuses());
break;
case self::STATUS_NEEDS_REVIEW:
$where[] = qsprintf(
@@ -802,19 +797,11 @@
ArcanistDifferentialRevisionStatus::ACCEPTED,
));
break;
- case self::STATUS_COMMITTED:
- phlog(
- "WARNING: DifferentialRevisionQuery using deprecated ".
- "STATUS_COMMITTED constant. This will be removed soon. ".
- "Use STATUS_CLOSED.");
- // fallthrough
case self::STATUS_CLOSED:
$where[] = qsprintf(
$conn_r,
'r.status IN (%Ld)',
- array(
- ArcanistDifferentialRevisionStatus::CLOSED,
- ));
+ DifferentialRevisionStatus::getClosedStatuses());
break;
case self::STATUS_ABANDONED:
$where[] = qsprintf(
diff --git a/src/applications/differential/search/DifferentialSearchIndexer.php b/src/applications/differential/search/DifferentialSearchIndexer.php
--- a/src/applications/differential/search/DifferentialSearchIndexer.php
+++ b/src/applications/differential/search/DifferentialSearchIndexer.php
@@ -44,8 +44,7 @@
PhabricatorPeoplePHIDTypeUser::TYPECONST,
$rev->getDateCreated());
- if ($rev->getStatus() != ArcanistDifferentialRevisionStatus::CLOSED &&
- $rev->getStatus() != ArcanistDifferentialRevisionStatus::ABANDONED) {
+ if (!$rev->isClosed()) {
$doc->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
$rev->getPHID(),
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
@@ -407,4 +407,9 @@
$this->repository = $repository;
return $this;
}
+
+ public function isClosed() {
+ return DifferentialRevisionStatus::isClosedStatus($this->getStatus());
+ }
+
}
diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php
--- a/src/applications/differential/view/DifferentialRevisionListView.php
+++ b/src/applications/differential/view/DifferentialRevisionListView.php
@@ -114,11 +114,6 @@
$list = new PHUIObjectItemListView();
$list->setCards(true);
- $do_not_display_age = array(
- ArcanistDifferentialRevisionStatus::CLOSED => true,
- ArcanistDifferentialRevisionStatus::ABANDONED => true,
- );
-
foreach ($this->revisions as $revision) {
$item = id(new PHUIObjectItemView())
->setUser($user);
@@ -146,8 +141,7 @@
$status = $revision->getStatus();
$show_age = ($fresh || $stale) &&
$this->highlightAge &&
- empty($do_not_display_age[$status]);
-
+ !$revision->isClosed();
$object_age = PHUIObjectItemView::AGE_FRESH;
foreach ($this->fields as $field) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/32/be/m6tqa7zlfsncadnn
Default Alt Text
D7653.diff (7 KB)
Attached To
Mode
D7653: Normalize the definition of "closed" revision statuses
Attached
Detach File
Event Timeline
Log In to Comment