Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15331728
D7653.id.diff
No One
Temporary
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.id.diff
View Options
Index: src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
===================================================================
--- src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
+++ 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);
}
}
Index: src/applications/differential/constants/DifferentialRevisionStatus.php
===================================================================
--- src/applications/differential/constants/DifferentialRevisionStatus.php
+++ 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());
+ }
+
}
Index: src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
===================================================================
--- src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
+++ 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) {
Index: src/applications/differential/phid/DifferentialPHIDTypeRevision.php
===================================================================
--- src/applications/differential/phid/DifferentialPHIDTypeRevision.php
+++ 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);
}
}
Index: src/applications/differential/query/DifferentialRevisionQuery.php
===================================================================
--- src/applications/differential/query/DifferentialRevisionQuery.php
+++ 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(
Index: src/applications/differential/search/DifferentialSearchIndexer.php
===================================================================
--- src/applications/differential/search/DifferentialSearchIndexer.php
+++ 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(),
Index: src/applications/differential/storage/DifferentialRevision.php
===================================================================
--- src/applications/differential/storage/DifferentialRevision.php
+++ src/applications/differential/storage/DifferentialRevision.php
@@ -407,4 +407,9 @@
$this->repository = $repository;
return $this;
}
+
+ public function isClosed() {
+ return DifferentialRevisionStatus::isClosedStatus($this->getStatus());
+ }
+
}
Index: src/applications/differential/view/DifferentialRevisionListView.php
===================================================================
--- src/applications/differential/view/DifferentialRevisionListView.php
+++ 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/plain
Expires
Sat, Mar 8, 1:09 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7382463
Default Alt Text
D7653.id.diff (7 KB)
Attached To
Mode
D7653: Normalize the definition of "closed" revision statuses
Attached
Detach File
Event Timeline
Log In to Comment