Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14031555
D15085.id36596.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.id36596.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 utf8_bin;
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
@@ -181,6 +181,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:
@@ -232,7 +233,10 @@
$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('wasAcceptedBeforeClose', $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
@@ -34,6 +34,7 @@
protected $repositoryPHID;
protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
protected $editPolicy = PhabricatorPolicies::POLICY_USER;
+ protected $properties = array();
private $relationships = self::ATTACHABLE;
private $commits = self::ATTACHABLE;
@@ -75,6 +76,7 @@
self::CONFIG_SERIALIZATION => array(
'attached' => self::SERIALIZATION_JSON,
'unsubscribed' => self::SERIALIZATION_JSON,
+ 'properties' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255',
@@ -113,6 +115,15 @@
) + 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 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,30 @@
return null;
}
+ $status = $revision->getStatus();
+
+ switch ($status) {
+ case ArcanistDifferentialRevisionStatus::ACCEPTED:
+ return $revision->getPHID();
+ case ArcanistDifferentialRevisionStatus::CLOSED:
+ $was_accepted =
+ $revision->getProperty('wasAcceptedBeforeClose', 'undefined');
+ switch ($was_accepted) {
+ case false:
+ return null;
+ case true:
+ return $revision->getPHID();
+ case 'undefined':
+ // continue on to old=style precommitRevisionStatus
+ break;
+ }
+ 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,17 @@
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('wasAcceptedBeforeClose')) {
+ return $revision->getPHID();
+ }
+ break;
}
- return $revision->getPHID();
+ return null;
}
protected function getHeraldFieldStandardType() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 10, 11:21 AM (4 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6758080
Default Alt Text
D15085.id36596.diff (6 KB)
Attached To
Mode
D15085: Revision substate CLOSED_FROM_ACCEPTED
Attached
Detach File
Event Timeline
Log In to Comment