Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14784357
D15085.id38929.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D15085.id38929.diff
View Options
diff --git a/resources/sql/autopatches/20160201.revision.properties.1.sql b/resources/sql/autopatches/20160201.revision.properties.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20160201.revision.properties.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_differential.differential_revision
+ADD properties LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/resources/sql/autopatches/20160201.revision.properties.2.sql b/resources/sql/autopatches/20160201.revision.properties.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20160201.revision.properties.2.sql
@@ -0,0 +1,2 @@
+UPDATE {$NAMESPACE}_differential.differential_revision
+SET properties = '{}' WHERE properties = '';
diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
@@ -206,6 +206,7 @@
'statusName' =>
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
$revision->getStatus()),
+ 'properties' => $revision->getProperties(),
'branch' => $diff->getBranch(),
'summary' => $revision->getSummary(),
'testPlan' => $revision->getTestPlan(),
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
@@ -182,6 +182,7 @@
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
$status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
$status_abandoned = ArcanistDifferentialRevisionStatus::ABANDONED;
+ $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
switch ($xaction->getTransactionType()) {
case DifferentialTransaction::TYPE_INLINE:
@@ -233,7 +234,12 @@
$object->setStatus($status_review);
return;
case DifferentialAction::ACTION_CLOSE:
+ $old_status = $object->getStatus();
$object->setStatus(ArcanistDifferentialRevisionStatus::CLOSED);
+ $was_accepted = ($old_status == $status_accepted);
+ $object->setProperty(
+ DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED,
+ $was_accepted);
return;
case DifferentialAction::ACTION_CLAIM:
$object->setAuthorPHID($this->getActingAsPHID());
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
@@ -35,6 +35,7 @@
protected $repositoryPHID;
protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
protected $editPolicy = PhabricatorPolicies::POLICY_USER;
+ protected $properties = array();
private $relationships = self::ATTACHABLE;
private $commits = self::ATTACHABLE;
@@ -53,6 +54,8 @@
const RELATION_REVIEWER = 'revw';
const RELATION_SUBSCRIBED = 'subd';
+ const PROPERTY_CLOSED_FROM_ACCEPTED = 'wasAcceptedBeforeClose';
+
public static function initializeNewRevision(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery())
->setViewer($actor)
@@ -76,6 +79,7 @@
self::CONFIG_SERIALIZATION => array(
'attached' => self::SERIALIZATION_JSON,
'unsubscribed' => self::SERIALIZATION_JSON,
+ 'properties' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255',
@@ -114,6 +118,19 @@
) + parent::getConfiguration();
}
+ public function setProperty($key, $value) {
+ $this->properties[$key] = $value;
+ return $this;
+ }
+
+ public function getProperty($key, $default = null) {
+ return idx($this->properties, $key, $default);
+ }
+
+ public function hasRevisionProperty($key) {
+ return array_key_exists($key, $this->properties);
+ }
+
public function getMonogram() {
$id = $this->getID();
return "D{$id}";
diff --git a/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
@@ -19,10 +19,31 @@
return null;
}
+ $status = $revision->getStatus();
+
+ switch ($status) {
+ case ArcanistDifferentialRevisionStatus::ACCEPTED:
+ return $revision->getPHID();
+ case ArcanistDifferentialRevisionStatus::CLOSED:
+ if ($revision->hasRevisionProperty(
+ DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
+
+ if ($revision->getProperty(
+ DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
+ return $revision->getPHID();
+ } else {
+ return null;
+ }
+ } else {
+ // continue on to old-style precommitRevisionStatus
+ break;
+ }
+ default:
+ return null;
+ }
+
$data = $object->getCommitData();
- $status = $data->getCommitDetail(
- 'precommitRevisionStatus',
- $revision->getStatus());
+ $status = $data->getCommitDetail('precommitRevisionStatus');
switch ($status) {
case ArcanistDifferentialRevisionStatus::ACCEPTED:
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
@@ -20,12 +20,19 @@
return null;
}
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
- if ($revision->getStatus() != $status_accepted) {
- return null;
+ switch ($revision->getStatus()) {
+ case ArcanistDifferentialRevisionStatus::ACCEPTED:
+ return $revision->getPHID();
+ case ArcanistDifferentialRevisionStatus::CLOSED:
+ if ($revision->getProperty(
+ DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
+
+ return $revision->getPHID();
+ }
+ break;
}
- return $revision->getPHID();
+ return null;
}
protected function getHeraldFieldStandardType() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 11:22 AM (14 h, 1 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7041793
Default Alt Text
D15085.id38929.diff (6 KB)
Attached To
Mode
D15085: Revision substate CLOSED_FROM_ACCEPTED
Attached
Detach File
Event Timeline
Log In to Comment